diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 01fcc25..e1be04c 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:solian/controllers/chat_events_controller.dart'; import 'package:solian/exts.dart'; import 'package:solian/providers/theme_switcher.dart'; import 'package:solian/router.dart'; @@ -93,6 +94,18 @@ class _SettingScreenState extends State { AppRouter.instance.pushNamed('about'); }, ), + TextButton( + style: const ButtonStyle( + visualDensity: VisualDensity(horizontal: -4, vertical: -4), + ), + child: Text('messageHistoryWipe'.tr), + onPressed: () { + final chatHistory = ChatEventController(); + chatHistory.initialize().then((_) async { + await chatHistory.database.localEvents.wipeLocalEvents(); + }); + }, + ), ], ).paddingSymmetric(horizontal: 12, vertical: 8), ], diff --git a/lib/translations/en_us.dart b/lib/translations/en_us.dart index ffa6281..dfecfe2 100644 --- a/lib/translations/en_us.dart +++ b/lib/translations/en_us.dart @@ -373,4 +373,5 @@ const i18nEnglish = { 'messageOutOfSync': 'May Out of Sync with Server', 'messageOutOfSyncCaption': 'Since the App has entered the background, there may be a time difference between the message list and the server. Click to Refresh.', + 'messageHistoryWipe': 'Wipe local message history', }; diff --git a/lib/translations/zh_cn.dart b/lib/translations/zh_cn.dart index a187bbf..ce05b45 100644 --- a/lib/translations/zh_cn.dart +++ b/lib/translations/zh_cn.dart @@ -339,4 +339,5 @@ const i18nSimplifiedChinese = { 'callStatusReconnected': '重连中', 'messageOutOfSync': '消息可能与服务器脱节', 'messageOutOfSyncCaption': '由于 App 进入后台,消息列表可能与服务器存在时差,点击刷新。', + 'messageHistoryWipe': '清除消息记录', }; diff --git a/lib/widgets/navigation/app_navigation_drawer.dart b/lib/widgets/navigation/app_navigation_drawer.dart index c219087..50579d0 100644 --- a/lib/widgets/navigation/app_navigation_drawer.dart +++ b/lib/widgets/navigation/app_navigation_drawer.dart @@ -1,3 +1,5 @@ +import 'dart:math' as math; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:solian/models/account_status.dart'; @@ -54,6 +56,7 @@ class _AppNavigationDrawerState extends State { backgroundColor: SolianTheme.isLargeScreen(context) ? Colors.transparent : null, child: SafeArea( + bottom: false, child: Column( children: [ Obx(() { @@ -187,7 +190,10 @@ class _AppNavigationDrawerState extends State { }, ), ], - ).paddingOnly(top: 8) + ).paddingOnly( + top: 8, + bottom: math.max(8, MediaQuery.of(context).padding.bottom), + ), ], ), ),