Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-26 20:35:04 +08:00
parent 20893ef65f
commit e5301c3cf8
3 changed files with 46 additions and 42 deletions

View File

@@ -58,11 +58,11 @@ Widget imageView(
} else if (picArr.length == 2) { } else if (picArr.length == 2) {
imageWidth = imageHeight = 2 * imageWidth; imageWidth = imageHeight = 2 * imageWidth;
} }
late final int row = picArr.length == 4 ? 2 : 3;
BorderRadius borderRadius(index) { BorderRadius borderRadius(index) {
if (picArr.length == 1) { if (picArr.length == 1) {
return StyleString.mdRadius; return StyleString.mdRadius;
} }
final int row = picArr.length == 4 ? 2 : 3;
return BorderRadius.only( return BorderRadius.only(
topLeft: index - row >= 0 || topLeft: index - row >= 0 ||
((index - 1) >= 0 && (index - 1) % row < index % row) ((index - 1) >= 0 && (index - 1) % row < index % row)

View File

@@ -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/common/widgets/dialog/dialog.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/http/user.dart';

View File

@@ -478,10 +478,15 @@ class _LoginPageState extends State<LoginPage> {
); );
} }
late EdgeInsets padding;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
padding = MediaQuery.paddingOf(context).copyWith(top: 0) +
const EdgeInsets.only(bottom: 25);
return OrientationBuilder(builder: (context, orientation) { return OrientationBuilder(builder: (context, orientation) {
final isLandscape = orientation == Orientation.landscape;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
@@ -492,48 +497,49 @@ class _LoginPageState extends State<LoginPage> {
title: Row( title: Row(
children: [ children: [
const Text('登录'), const Text('登录'),
if (orientation == Orientation.landscape) ...[ if (isLandscape)
const Spacer(flex: 3), Expanded(
Flexible( child: Align(
flex: 5, alignment: Alignment.centerRight,
child: TabBar( child: TabBar(
dividerHeight: 0, isScrollable: true,
tabs: const [ dividerHeight: 0,
Tab( tabs: const [
child: Row( Tab(
mainAxisSize: MainAxisSize.min, child: Row(
children: [Icon(Icons.password), Text(' 密码')], mainAxisSize: MainAxisSize.min,
children: [Icon(Icons.password), Text(' 密码')],
),
), ),
), Tab(
Tab( child: Row(
child: Row( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [Icon(Icons.sms_outlined), Text(' 短信')],
children: [Icon(Icons.sms_outlined), Text(' 短信')], ),
), ),
), Tab(
Tab( child: Row(
child: Row( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [Icon(Icons.qr_code), Text(' 扫码')],
children: [Icon(Icons.qr_code), Text(' 扫码')], ),
), ),
), Tab(
Tab( child: Row(
child: Row( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [
children: [ Icon(Icons.cookie_outlined),
Icon(Icons.cookie_outlined), Text(' Cookie')
Text(' Cookie') ],
], ),
), ),
), ],
], controller: _loginPageCtr.tabController,
controller: _loginPageCtr.tabController, ),
), ),
) )
],
], ],
), ),
bottom: orientation == Orientation.portrait bottom: !isLandscape
? TabBar( ? TabBar(
tabs: const [ tabs: const [
Tab(icon: Icon(Icons.password), text: '密码'), Tab(icon: Icon(Icons.password), text: '密码'),
@@ -545,14 +551,12 @@ class _LoginPageState extends State<LoginPage> {
) )
: null, : null,
), ),
body: NotificationListener( body: NotificationListener<ScrollStartNotification>(
onNotification: (notification) { onNotification: (notification) {
if (notification is ScrollUpdateNotification) { if (notification.metrics.axis == Axis.horizontal) {
if (notification.metrics.axis == Axis.horizontal) { FocusScope.of(context).unfocus();
FocusScope.of(context).unfocus();
}
} }
return true; return false;
}, },
child: tabBarView( child: tabBarView(
controller: _loginPageCtr.tabController, controller: _loginPageCtr.tabController,
@@ -570,6 +574,7 @@ class _LoginPageState extends State<LoginPage> {
Widget tabViewOuter(Widget child) { Widget tabViewOuter(Widget child) {
return SingleChildScrollView( return SingleChildScrollView(
padding: padding,
child: Align( child: Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: ConstrainedBox( child: ConstrainedBox(