cache
This commit is contained in:
@@ -17,42 +17,89 @@ class _CustomContent extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final proxyGroupNum = ref.watch(
|
||||
proxyGroupsProvider(
|
||||
profileId,
|
||||
).select((state) => state.value?.length ?? -1),
|
||||
);
|
||||
final ruleNum = ref.watch(
|
||||
profileCustomRulesProvider(
|
||||
profileId,
|
||||
).select((state) => state.value?.length ?? -1),
|
||||
);
|
||||
return SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(child: SizedBox(height: 24)),
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
children: [InfoHeader(info: Info(label: '代理组'))],
|
||||
children: [InfoHeader(info: Info(label: '自定义'))],
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 8)),
|
||||
_CustomProxyGroups(profileId),
|
||||
// SliverToBoxAdapter(
|
||||
// child: Column(
|
||||
// children: [InfoHeader(info: Info(label: '规则'))],
|
||||
// ),
|
||||
// ),
|
||||
// _CustomRules(profileId: profileId),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 32)),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MaterialBanner(
|
||||
elevation: 0,
|
||||
dividerColor: Colors.transparent,
|
||||
content: Text('检测到没有数据'),
|
||||
actions: [
|
||||
CommonMinFilledButtonTheme(
|
||||
child: FilledButton.tonal(
|
||||
onPressed: _handleUseDefault,
|
||||
child: Text('一键填入'),
|
||||
SliverToBoxAdapter(
|
||||
child: _MoreActionButton(
|
||||
label: '代理组',
|
||||
onPressed: () {},
|
||||
trailing: Card.filled(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minWidth: 44),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
'$proxyGroupNum',
|
||||
style: context.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 4)),
|
||||
SliverToBoxAdapter(
|
||||
child: _MoreActionButton(
|
||||
label: '规则',
|
||||
onPressed: () {},
|
||||
trailing: Card.filled(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minWidth: 44),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: Text(
|
||||
'$ruleNum',
|
||||
style: context.textTheme.bodySmall,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 32)),
|
||||
if (proxyGroupNum == 0 && ruleNum == 0)
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MaterialBanner(
|
||||
elevation: 0,
|
||||
dividerColor: Colors.transparent,
|
||||
content: Text('检测到没有数据'),
|
||||
actions: [
|
||||
CommonMinFilledButtonTheme(
|
||||
child: FilledButton.tonal(
|
||||
onPressed: _handleUseDefault,
|
||||
child: Text('一键填入'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// SliverToBoxAdapter(child: SizedBox(height: 8)),
|
||||
// SliverToBoxAdapter(
|
||||
// child: Padding(
|
||||
|
||||
@@ -19,6 +19,7 @@ import 'package:reorderable_grid/reorderable_grid.dart';
|
||||
import 'package:super_sliver_list/super_sliver_list.dart';
|
||||
|
||||
part 'custom.dart';
|
||||
part 'widgets.dart';
|
||||
|
||||
class OverwriteView extends ConsumerStatefulWidget {
|
||||
final int profileId;
|
||||
|
||||
31
lib/views/profiles/overwrite/widgets.dart
Normal file
31
lib/views/profiles/overwrite/widgets.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
part of 'overwrite.dart';
|
||||
|
||||
class _MoreActionButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
final String label;
|
||||
final Widget? trailing;
|
||||
|
||||
const _MoreActionButton({this.onPressed, required this.label, this.trailing});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: CommonCard(
|
||||
radius: 18,
|
||||
onPressed: onPressed,
|
||||
child: ListTile(
|
||||
minTileHeight: 0,
|
||||
minVerticalPadding: 0,
|
||||
titleTextStyle: context.textTheme.bodyMedium?.toJetBrainsMono,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
),
|
||||
title: Text(label, style: context.textTheme.bodyLarge),
|
||||
trailing: trailing ?? Icon(Icons.arrow_forward_ios, size: 18),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user