This commit is contained in:
chen08209
2026-03-11 17:19:32 +08:00
parent f0417cac58
commit bc0bbc6ede
3 changed files with 52 additions and 30 deletions

View File

@@ -45,7 +45,7 @@ class _CustomContent extends ConsumerWidget {
SliverToBoxAdapter(child: SizedBox(height: 8)),
SliverToBoxAdapter(
child: _MoreActionButton(
label: '代理',
label: '策略',
onPressed: () {
_handleToProxyGroupsView(context, profileId);
},

View File

@@ -70,6 +70,10 @@ class _CustomProxyGroupsView extends ConsumerWidget {
),
);
},
itemExtent:
28 +
globalState.measure.bodyMediumHeight +
globalState.measure.bodyLargeHeight,
itemCount: proxyGroups.length,
onReorder: (oldIndex, newIndex) {
_handleReorder(ref, profileId, oldIndex, newIndex);
@@ -82,7 +86,7 @@ class _CustomProxyGroupsView extends ConsumerWidget {
class _EditProxyGroupNestedSheet extends StatelessWidget {
const _EditProxyGroupNestedSheet();
Future<void> _handlePop(
Future<void> _handleClose(
BuildContext context,
NavigatorState? navigatorState,
) async {
@@ -99,6 +103,17 @@ class _EditProxyGroupNestedSheet extends StatelessWidget {
}
}
Future<void> _handlePop(
BuildContext context,
NavigatorState? navigatorState,
) async {
if (navigatorState != null && navigatorState.canPop()) {
navigatorState.pop();
} else {
Navigator.of(context).pop();
}
}
@override
Widget build(BuildContext context) {
final GlobalKey<NavigatorState> nestedNavigatorKey = GlobalKey();
@@ -115,39 +130,45 @@ class _EditProxyGroupNestedSheet extends StatelessWidget {
},
);
final sheetProvider = SheetProvider.of(context);
return CommonPopScope(
onPop: (_) async {
_handlePop(context, nestedNavigatorKey.currentState);
return false;
},
child: sheetProvider!.copyWith(
nestedNavigatorPopCallback: () {
Navigator.of(context).pop();
return BackButtonListener(
child: CommonPopScope(
onPop: (_) async {
_handleClose(context, nestedNavigatorKey.currentState);
return false;
},
child: Stack(
children: [
Positioned.fill(
child: GestureDetector(
onTap: () async {
_handlePop(context, nestedNavigatorKey.currentState);
},
),
),
SheetViewport(
child: PagedSheet(
decoration: MaterialSheetDecoration(
size: SheetSize.stretch,
borderRadius: sheetProvider.type == SheetType.bottomSheet
? BorderRadius.vertical(top: Radius.circular(28))
: BorderRadius.zero,
clipBehavior: Clip.antiAlias,
child: sheetProvider!.copyWith(
nestedNavigatorPopCallback: () {
Navigator.of(context).pop();
},
child: Stack(
children: [
Positioned.fill(
child: GestureDetector(
onTap: () async {
_handlePop(context, nestedNavigatorKey.currentState);
},
),
navigator: nestedNavigator,
),
),
],
SheetViewport(
child: PagedSheet(
decoration: MaterialSheetDecoration(
size: SheetSize.stretch,
borderRadius: sheetProvider.type == SheetType.bottomSheet
? BorderRadius.vertical(top: Radius.circular(28))
: BorderRadius.zero,
clipBehavior: Clip.antiAlias,
),
navigator: nestedNavigator,
),
),
],
),
),
),
onBackButtonPressed: () async {
_handlePop(context, nestedNavigatorKey.currentState);
return true;
},
);
}
}

View File

@@ -13,6 +13,7 @@ import 'package:fl_clash/views/config/scripts.dart';
import 'package:fl_clash/views/profiles/preview.dart';
import 'package:fl_clash/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:smooth_sheets/smooth_sheets.dart';