diff --git a/lib/common/widgets/image/image_view.dart b/lib/common/widgets/image/image_view.dart index 118954cb4..2636b3c79 100644 --- a/lib/common/widgets/image/image_view.dart +++ b/lib/common/widgets/image/image_view.dart @@ -58,11 +58,11 @@ Widget imageView( } else if (picArr.length == 2) { imageWidth = imageHeight = 2 * imageWidth; } + late final int row = picArr.length == 4 ? 2 : 3; BorderRadius borderRadius(index) { if (picArr.length == 1) { return StyleString.mdRadius; } - final int row = picArr.length == 4 ? 2 : 3; return BorderRadius.only( topLeft: index - row >= 0 || ((index - 1) >= 0 && (index - 1) % row < index % row) diff --git a/lib/pages/later/controller.dart b/lib/pages/later/controller.dart index 827456f32..d190b159a 100644 --- a/lib/pages/later/controller.dart +++ b/lib/pages/later/controller.dart @@ -1,4 +1,3 @@ -// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:PiliPlus/common/widgets/dialog/dialog.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/user.dart'; diff --git a/lib/pages/login/view.dart b/lib/pages/login/view.dart index c48fbf2e1..0f1116bc5 100644 --- a/lib/pages/login/view.dart +++ b/lib/pages/login/view.dart @@ -478,10 +478,15 @@ class _LoginPageState extends State { ); } + late EdgeInsets padding; + @override Widget build(BuildContext context) { final theme = Theme.of(context); + padding = MediaQuery.paddingOf(context).copyWith(top: 0) + + const EdgeInsets.only(bottom: 25); return OrientationBuilder(builder: (context, orientation) { + final isLandscape = orientation == Orientation.landscape; return Scaffold( appBar: AppBar( leading: IconButton( @@ -492,48 +497,49 @@ class _LoginPageState extends State { title: Row( children: [ const Text('登录'), - if (orientation == Orientation.landscape) ...[ - const Spacer(flex: 3), - Flexible( - flex: 5, - child: TabBar( - dividerHeight: 0, - tabs: const [ - Tab( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [Icon(Icons.password), Text(' 密码')], + if (isLandscape) + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: TabBar( + isScrollable: true, + dividerHeight: 0, + tabs: const [ + Tab( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [Icon(Icons.password), Text(' 密码')], + ), ), - ), - Tab( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [Icon(Icons.sms_outlined), Text(' 短信')], + Tab( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [Icon(Icons.sms_outlined), Text(' 短信')], + ), ), - ), - Tab( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [Icon(Icons.qr_code), Text(' 扫码')], + Tab( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [Icon(Icons.qr_code), Text(' 扫码')], + ), ), - ), - Tab( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon(Icons.cookie_outlined), - Text(' Cookie') - ], + Tab( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.cookie_outlined), + Text(' Cookie') + ], + ), ), - ), - ], - controller: _loginPageCtr.tabController, + ], + controller: _loginPageCtr.tabController, + ), ), ) - ], ], ), - bottom: orientation == Orientation.portrait + bottom: !isLandscape ? TabBar( tabs: const [ Tab(icon: Icon(Icons.password), text: '密码'), @@ -545,14 +551,12 @@ class _LoginPageState extends State { ) : null, ), - body: NotificationListener( + body: NotificationListener( onNotification: (notification) { - if (notification is ScrollUpdateNotification) { - if (notification.metrics.axis == Axis.horizontal) { - FocusScope.of(context).unfocus(); - } + if (notification.metrics.axis == Axis.horizontal) { + FocusScope.of(context).unfocus(); } - return true; + return false; }, child: tabBarView( controller: _loginPageCtr.tabController, @@ -570,6 +574,7 @@ class _LoginPageState extends State { Widget tabViewOuter(Widget child) { return SingleChildScrollView( + padding: padding, child: Align( alignment: Alignment.topCenter, child: ConstrainedBox(