Я создаю адаптивную страницу аутентификации во Flutter, которая работает в альбомном режиме без прокрутки. В левой части отображается изображение, а в правой — формы и кнопки. Задача — обеспечить быстроту реагирования, особенно правостороннего контента, без включения прокрутки.
Код: Выделить всё
class AuthPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
]);
double screenHeight = MediaQuery.of(context).size.height;
double screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.transparent,
body: Row(
children: [
// Left-side image
Flexible(
flex: 3,
child: CardsImage(screenHeight: screenHeight),
),
// Right-side form
Flexible(
flex: 3,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: screenWidth * 0.03,
vertical: screenHeight * 0.02,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Repeated BlocBuilder handling AuthState logic
// Form fields and buttons
],
),
),
),
],
),
);
}
}
- Использовал Flexible для обоих разделов.
- Отступы и поля рассчитываются в процентах от размеров экрана.
- Пытался использовать ScreenUtil для оперативного масштабирования, но проблема не устранена.
Подробнее здесь: https://stackoverflow.com/questions/791 ... rtionate-o