Commit b8c8aab8 by tanghuan

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

1 parent e257b297
import 'package:appframe/bloc/web_cubit.dart';
import 'package:appframe/config/constant.dart';
import 'package:appframe/config/locator.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
......@@ -72,10 +73,10 @@ class WebPage extends StatelessWidget {
width: MediaQuery.of(ctx).size.width * 0.8,
child: Column(children: [
DrawerHeader(
decoration: BoxDecoration(
color: Color(0xFF7691FA),
),
child: Align(
decoration: BoxDecoration(
color: Color(0xFF7691FA),
),
child: Align(
alignment: Alignment.centerLeft,
child: Text('设置',
style: TextStyle(
......@@ -127,7 +128,7 @@ class WebPage extends StatelessWidget {
title: const Text('清理缓存'),
onTap: () {
Navigator.pop(ctx);
ctx.read<WebCubit>().clearStorage();
_showClearCacheDialog(ctx);
},
),
ListTile(
......@@ -147,12 +148,19 @@ class WebPage extends StatelessWidget {
width: double.infinity,
padding: const EdgeInsets.all(16.0),
child: Center(
child: Text(
'版权所有 © 2025',
style: TextStyle(
color: Colors.grey,
fontSize: 12,
),
child: Column(
children: [
Text(
'Version ${Constant.appVersion}',
style: TextStyle(
color: Colors.grey,
fontSize: 12,
),
),
Text(
'Copyright © 中山班小二科技有限公司',
),
],
),
),
),
......@@ -241,4 +249,32 @@ class WebPage extends StatelessWidget {
),
);
}
}
\ 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!