297 lines
13 KiB
Dart
297 lines
13 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:aslan/app_localizations.dart';
|
|
import 'package:aslan/chatvibe_ui/components/appbar/chatvibe_appbar.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_ui/components/at_tts.dart';
|
|
import 'package:aslan/chatvibe_data/sources/local/user_manager.dart';
|
|
import 'package:aslan/chatvibe_features/index/main_route.dart';
|
|
import 'package:aslan/chatvibe_features/user/settings/settings_route.dart';
|
|
|
|
import 'package:aslan/chatvibe_ui/components/dialog/dialog_base.dart';
|
|
import 'package:aslan/chatvibe_core/constants/at_global_config.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_app_utils.dart';
|
|
|
|
///设置页面
|
|
class SettingsPage extends StatefulWidget {
|
|
@override
|
|
_SettingsPageState createState() => _SettingsPageState();
|
|
}
|
|
|
|
class _SettingsPageState extends State<SettingsPage> {
|
|
String totalSize = "0";
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_loadCacheSize();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
Image.asset(
|
|
ATGlobalConfig.businessLogicStrategy.getSettingsPageBackgroundImage(),
|
|
width: ScreenUtil().screenWidth,
|
|
height: ScreenUtil().screenHeight,
|
|
fit: BoxFit.fill,
|
|
),
|
|
Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
resizeToAvoidBottomInset: false,
|
|
appBar: ChatVibeStandardAppBar(
|
|
title: ATAppLocalizations.of(context)!.settings,
|
|
actions: [],
|
|
),
|
|
body: SafeArea(
|
|
top: false,
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
alignment: AlignmentDirectional.bottomStart,
|
|
margin: EdgeInsetsDirectional.only(start: 15.w),
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.account,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPageSecondaryTextColor(),
|
|
fontSize: 12.sp,
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 12.w),
|
|
margin: EdgeInsets.symmetric(vertical: 8.w, horizontal: 15.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageMainContainerBackgroundColor(),
|
|
border: Border.all(color: ATGlobalConfig.businessLogicStrategy.getSettingsPageMainContainerBorderColor(), width: 1.w),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ATDebounceWidget(
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 18.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.account,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPagePrimaryTextColor(),
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
Spacer(),
|
|
Icon(
|
|
ATGlobalConfig.lang == "ar"
|
|
? Icons.keyboard_arrow_left
|
|
: Icons.keyboard_arrow_right,
|
|
size: 15.w,
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageIconColor(),
|
|
),
|
|
SizedBox(width: 18.w),
|
|
],
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
SettingsRoute.account,
|
|
replace: false,
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 12.w),
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBackgroundColor(),
|
|
border: Border.all(color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBorderColor(), width: 1.w),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ATDebounceWidget(
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 18.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.blockedList,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPagePrimaryTextColor(),
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
Spacer(),
|
|
Icon(
|
|
ATGlobalConfig.lang == "ar"
|
|
? Icons.keyboard_arrow_left
|
|
: Icons.keyboard_arrow_right,
|
|
size: 15.w,
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageIconColor(),
|
|
),
|
|
SizedBox(width: 18.w),
|
|
],
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
SettingsRoute.blockedList,
|
|
replace: false,
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 8.w),
|
|
Container(
|
|
alignment: AlignmentDirectional.bottomStart,
|
|
margin: EdgeInsetsDirectional.only(start: 15.w),
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.common,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPageCommonTextColor(),
|
|
fontSize: 12.sp,
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 12.w),
|
|
margin: EdgeInsets.symmetric(vertical: 8.w, horizontal: 15.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBackgroundColor(),
|
|
border: Border.all(color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBorderColor(), width: 1.w),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ATDebounceWidget(
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 18.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.language,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPagePrimaryTextColor(),
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
Spacer(),
|
|
Icon(
|
|
ATGlobalConfig.lang == "ar"
|
|
? Icons.keyboard_arrow_left
|
|
: Icons.keyboard_arrow_right,
|
|
size: 15.w,
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageIconColor(),
|
|
),
|
|
SizedBox(width: 18.w),
|
|
],
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
MainRoute.language,
|
|
replace: false,
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 8.w),
|
|
Container(
|
|
alignment: AlignmentDirectional.bottomStart,
|
|
margin: EdgeInsetsDirectional.only(start: 15.w),
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.about,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPageAboutTextColor(),
|
|
fontSize: 12.sp,
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 12.w),
|
|
margin: EdgeInsets.symmetric(vertical: 8.w, horizontal: 15.w),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBackgroundColor(),
|
|
border: Border.all(color: ATGlobalConfig.businessLogicStrategy.getSettingsPageContainerBorderColor(), width: 1.w),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
ATDebounceWidget(
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
SettingsRoute.about,
|
|
replace: false,
|
|
);
|
|
},
|
|
child: Row(
|
|
children: [
|
|
SizedBox(width: 18.w),
|
|
text(
|
|
ATAppLocalizations.of(context)!.aboutUs,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPagePrimaryTextColor(),
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
Spacer(),
|
|
Icon(
|
|
ATGlobalConfig.lang == "ar"
|
|
? Icons.keyboard_arrow_left
|
|
: Icons.keyboard_arrow_right,
|
|
size: 15.w,
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageIconColor(),
|
|
),
|
|
SizedBox(width: 18.w),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ATDebounceWidget(
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
padding: EdgeInsets.symmetric(vertical: 10.w),
|
|
margin: EdgeInsets.symmetric(
|
|
horizontal: 55.w,
|
|
vertical: 35.w,
|
|
),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(25.w),
|
|
color: ATGlobalConfig.businessLogicStrategy.getSettingsPageButtonBackgroundColor(),
|
|
),
|
|
child: text(
|
|
ATAppLocalizations.of(context)!.logout,
|
|
fontSize: 14.sp,
|
|
textColor: ATGlobalConfig.businessLogicStrategy.getSettingsPageButtonTextColor(),
|
|
),
|
|
),
|
|
onTap: () {
|
|
AccountStorage().logout(context);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
void _loadCacheSize() {
|
|
ATAppUtils.collectCacheSize()
|
|
.then((res) {
|
|
totalSize = res;
|
|
setState(() {});
|
|
})
|
|
.catchError((_) {});
|
|
}
|
|
}
|