Commit b8c8aab8 by tanghuan

清理缓存的时候,弹框提示信息,让用户确认或取消操作

1 parent e257b297
import 'package:appframe/bloc/web_cubit.dart'; import 'package:appframe/bloc/web_cubit.dart';
import 'package:appframe/config/constant.dart';
import 'package:appframe/config/locator.dart'; import 'package:appframe/config/locator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
...@@ -72,10 +73,10 @@ class WebPage extends StatelessWidget { ...@@ -72,10 +73,10 @@ class WebPage extends StatelessWidget {
width: MediaQuery.of(ctx).size.width * 0.8, width: MediaQuery.of(ctx).size.width * 0.8,
child: Column(children: [ child: Column(children: [
DrawerHeader( DrawerHeader(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF7691FA), color: Color(0xFF7691FA),
), ),
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text('设置', child: Text('设置',
style: TextStyle( style: TextStyle(
...@@ -127,7 +128,7 @@ class WebPage extends StatelessWidget { ...@@ -127,7 +128,7 @@ class WebPage extends StatelessWidget {
title: const Text('清理缓存'), title: const Text('清理缓存'),
onTap: () { onTap: () {
Navigator.pop(ctx); Navigator.pop(ctx);
ctx.read<WebCubit>().clearStorage(); _showClearCacheDialog(ctx);
}, },
), ),
ListTile( ListTile(
...@@ -147,12 +148,19 @@ class WebPage extends StatelessWidget { ...@@ -147,12 +148,19 @@ class WebPage extends StatelessWidget {
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Center( child: Center(
child: Text( child: Column(
'版权所有 © 2025', children: [
style: TextStyle( Text(
color: Colors.grey, 'Version ${Constant.appVersion}',
fontSize: 12, style: TextStyle(
), color: Colors.grey,
fontSize: 12,
),
),
Text(
'Copyright © 中山班小二科技有限公司',
),
],
), ),
), ),
), ),
...@@ -241,4 +249,32 @@ class WebPage extends StatelessWidget { ...@@ -241,4 +249,32 @@ class WebPage extends StatelessWidget {
), ),
); );
} }
}
\ No newline at end of file \ No newline at end of file
void _showClearCacheDialog(BuildContext ctx) {
showDialog(
context: ctx,
builder: (BuildContext context) {
return AlertDialog(
title: Text('清理缓存'),
content: Text('清理缓存后将需要重新登录,是否继续?'),
actions: <Widget>[
TextButton(
child: Text('取消'),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text('确认'),
onPressed: () {
Navigator.of(context).pop();
ctx.read<WebCubit>().clearStorage();
ctx.read<WebCubit>().goLogin();
},
),
],
);
},
);
}
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!