184 lines
5.6 KiB
Dart
Executable File
184 lines
5.6 KiB
Dart
Executable File
import 'dart:async';
|
|
import 'dart:ui';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
|
import 'package:star_lock/baseWidget.dart';
|
|
import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
|
|
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
|
|
import 'package:star_lock/mine/mall/lockMall_page.dart';
|
|
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
|
|
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
|
import 'package:star_lock/tools/noData.dart';
|
|
import 'package:star_lock/tools/submitBtn.dart';
|
|
import 'package:star_lock/translations/trans_lib.dart';
|
|
|
|
class StarLockMainXHJPage extends StatefulWidget {
|
|
const StarLockMainXHJPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<StarLockMainXHJPage> createState() => _StarLockMainXHJPageState();
|
|
}
|
|
|
|
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|
with BaseWidget {
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<LockMainXHJLogic>(
|
|
init: LockMainXHJLogic(),
|
|
builder: (LockMainXHJLogic logic) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
body: Stack(
|
|
children: <Widget>[
|
|
pageView(
|
|
widget: StarLockMainPage(
|
|
showAppBar: false,
|
|
showDrawer: false,
|
|
),
|
|
logic: logic,
|
|
index: 0,
|
|
),
|
|
pageView(
|
|
widget: SafeArea(
|
|
bottom: false,
|
|
child: LockMallPage(
|
|
allowReturn: false,
|
|
),
|
|
),
|
|
logic: logic,
|
|
index: 1,
|
|
),
|
|
pageView(
|
|
widget: SafeArea(
|
|
bottom: false,
|
|
child: MessageListXHJPage(
|
|
showAppBar: false,
|
|
),
|
|
),
|
|
logic: logic,
|
|
index: 2,
|
|
),
|
|
pageView(
|
|
widget: SafeArea(
|
|
bottom: false,
|
|
child: MineSetPage(
|
|
showAppBar: false,
|
|
showAbout: true,
|
|
),
|
|
),
|
|
logic: logic,
|
|
index: 3,
|
|
),
|
|
],
|
|
),
|
|
bottomNavigationBar: Container(
|
|
padding: EdgeInsets.only(
|
|
top: 20.h, bottom: GetPlatform.isAndroid ? 20.h : 0),
|
|
decoration: const BoxDecoration(
|
|
color: Colors.transparent,
|
|
border: Border(
|
|
top: BorderSide(
|
|
color: Colors.black, // 设置边框颜色
|
|
width: 0.3, // 设置边框宽度
|
|
),
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
top: false,
|
|
child: Row(
|
|
children: <Widget>[
|
|
navigationBarItem(Icons.key,
|
|
TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
|
|
logic.setIndex(0);
|
|
}),
|
|
navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1,
|
|
() {
|
|
logic.setIndex(1);
|
|
}),
|
|
navigationBarItem(Icons.message,
|
|
TranslationLoader.lanKeys!.message!.tr, logic, 2, () {
|
|
logic.setIndex(2);
|
|
}),
|
|
navigationBarItem(Icons.account_circle, '我的'.tr, logic, 3,
|
|
() {
|
|
logic.setIndex(3);
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
//布局
|
|
Widget pageView(
|
|
{required Widget widget,
|
|
required LockMainXHJLogic logic,
|
|
required int index}) {
|
|
return Positioned.fill(
|
|
child: Offstage(
|
|
offstage: logic.state.index != index,
|
|
child: widget,
|
|
),
|
|
);
|
|
}
|
|
|
|
//底部按钮
|
|
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
|
|
int index, GestureTapCallback? onTop) {
|
|
final bool check = logic.state.index == index;
|
|
return Expanded(
|
|
child: GestureDetector(
|
|
onTap: onTop,
|
|
child: Container(
|
|
color: Colors.transparent,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: EdgeInsets.only(bottom: 8.h),
|
|
child: Icon(
|
|
icon,
|
|
size: 32.r,
|
|
color:
|
|
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
|
|
),
|
|
),
|
|
Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
color:
|
|
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
}
|