棉花app新增页面
This commit is contained in:
@@ -35,7 +35,7 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
|
||||
return Stack(
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: themeController.currentColor.sc5,
|
||||
backgroundColor: Color(0xFF003058),
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
borderRadius: 20.rpx,
|
||||
padding:
|
||||
@@ -93,7 +93,7 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 35.rpx)),
|
||||
].divide(SizedBox(width: 30.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
246
lib/pages/main_bottom/component/main_page_b_bottom_change.dart
Normal file
246
lib/pages/main_bottom/component/main_page_b_bottom_change.dart
Normal file
@@ -0,0 +1,246 @@
|
||||
// import 'dart:io';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter/services.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
// import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
// import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
|
||||
// import 'package:vbvs_app/controller/message/message_controller.dart';
|
||||
// import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
// import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
// import 'package:vbvs_app/enum/LoginStatus.dart';
|
||||
// import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||
// import 'package:vbvs_app/pages/main_bottom/e_page.dart';
|
||||
// import 'package:vbvs_app/pages/main_bottom/home_page.dart';
|
||||
// import 'package:vbvs_app/pages/main_bottom/message_page.dart';
|
||||
// import 'package:vbvs_app/pages/main_bottom/mine_page.dart';
|
||||
|
||||
// class MainPageBBottomChange extends StatefulWidget {
|
||||
// const MainPageBBottomChange({super.key});
|
||||
|
||||
// @override
|
||||
// State<MainPageBBottomChange> createState() => _MainPageBottomChangeState();
|
||||
// }
|
||||
|
||||
// class _MainPageBottomChangeState extends State<MainPageBBottomChange>
|
||||
// with SingleTickerProviderStateMixin {
|
||||
// final GlobalController globalController = Get.find();
|
||||
// final ThemeController themeController = Get.find();
|
||||
// final MessageController messageController = Get.find();
|
||||
// final MainPageController controller = Get.find();
|
||||
// final UserInfoController userInfoController = Get.find();
|
||||
|
||||
// late AnimationController _animationController;
|
||||
// late Animation<double> _positionAnimation;
|
||||
|
||||
// final List<Widget> pages = [
|
||||
// const HomePage(),
|
||||
// const EPage(),
|
||||
// const MessagePage(),
|
||||
// const MinePage(),
|
||||
// ];
|
||||
|
||||
// final List<String> titles = ['首页', '报告', '控制', '我的'];
|
||||
// final List<IconData> icons = [
|
||||
// Icons.home,
|
||||
// Icons.android,
|
||||
// Icons.message,
|
||||
// Icons.person,
|
||||
// ];
|
||||
|
||||
// int selectedIndex = 0;
|
||||
// double currentPosition = 0.0;
|
||||
|
||||
// DateTime? _lastBackPressedTime;
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// selectedIndex = controller.model.currentIndex;
|
||||
// currentPosition = selectedIndex.toDouble();
|
||||
|
||||
// _animationController = AnimationController(
|
||||
// vsync: this,
|
||||
// duration: const Duration(milliseconds: 300),
|
||||
// );
|
||||
|
||||
// _positionAnimation = Tween<double>(
|
||||
// begin: currentPosition,
|
||||
// end: currentPosition,
|
||||
// ).animate(CurvedAnimation(
|
||||
// parent: _animationController,
|
||||
// curve: Curves.easeOut,
|
||||
// ))
|
||||
// ..addListener(() {
|
||||
// setState(() {});
|
||||
// });
|
||||
// }
|
||||
|
||||
// void _onTabTapped(int index) {
|
||||
// bool isLoggedIn = userInfoController.model.login == LoginStatus.LOGIN.code;
|
||||
|
||||
// if ((index == 1 || index == 2) && !isLoggedIn) {
|
||||
// TopSlideNotification.show(context, text: "必须登录提示".tr);
|
||||
// Future.delayed(const Duration(milliseconds: 100), () {
|
||||
// Get.toNamed("/loginPage");
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (selectedIndex != index) {
|
||||
// final begin = currentPosition;
|
||||
// final end = index.toDouble();
|
||||
// _positionAnimation = Tween<double>(begin: begin, end: end).animate(
|
||||
// CurvedAnimation(parent: _animationController, curve: Curves.easeOut),
|
||||
// )..addListener(() {
|
||||
// setState(() {});
|
||||
// });
|
||||
|
||||
// _animationController.forward(from: 0.0);
|
||||
// currentPosition = end;
|
||||
// selectedIndex = index;
|
||||
|
||||
// controller.model.currentIndex = index;
|
||||
// controller.updateAll();
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _animationController.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
// Future<bool> _handleBackPressed() async {
|
||||
// final now = DateTime.now();
|
||||
// if (_lastBackPressedTime == null ||
|
||||
// now.difference(_lastBackPressedTime!) > const Duration(seconds: 2)) {
|
||||
// _lastBackPressedTime = now;
|
||||
// TopSlideNotification.show(context, text: "滑动退出提醒".tr);
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return PopScope(
|
||||
// canPop: false,
|
||||
// onPopInvokedWithResult: (disposition, result) async {
|
||||
// if (Platform.isAndroid) {
|
||||
// final exit = await _handleBackPressed();
|
||||
// if (exit) SystemNavigator.pop();
|
||||
// }
|
||||
// },
|
||||
// child: Obx(() {
|
||||
// final hideBar = globalController.model.hideBottomNavigationBar;
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// body: pages[controller.model.currentIndex],
|
||||
// bottomNavigationBar: hideBar
|
||||
// ? null
|
||||
// : BezierBottomNavigationBar(
|
||||
// selectedIndex: selectedIndex,
|
||||
// animatedPosition: _positionAnimation.value,
|
||||
// icons: icons,
|
||||
// titles: titles,
|
||||
// onTap: _onTabTapped,
|
||||
// ),
|
||||
// );
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||
import 'package:vbvs_app/pages/device_control/MattressControl.dart';
|
||||
import 'package:vbvs_app/pages/device_control/new_Home_page.dart';
|
||||
import 'package:vbvs_app/pages/device_control/new_mine_page.dart';
|
||||
import 'package:vbvs_app/pages/device_control/score_page.dart';
|
||||
|
||||
class MainPageBBottomChange extends StatefulWidget {
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<MainPageBBottomChange>
|
||||
with SingleTickerProviderStateMixin {
|
||||
int selectedIndex = 0;
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _positionAnimation;
|
||||
double currentPosition = 0.0;
|
||||
|
||||
final List<String> titles = ['首页', '报告', '控制', '我的'];
|
||||
final List<String> path = [
|
||||
"assets/images/bar_home.svg",
|
||||
"assets/images/bar_heart.svg",
|
||||
"assets/images/bar_control.svg",
|
||||
"assets/images/bar_mine.svg"
|
||||
];
|
||||
|
||||
final List<Widget> pages = [
|
||||
NewHomePage(),
|
||||
// PeopleInfoPage(),
|
||||
// Text('报告'),
|
||||
ScorePage(),
|
||||
// Smys(),
|
||||
MattressControlPage(),
|
||||
NewMinePage()
|
||||
];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 300));
|
||||
currentPosition = selectedIndex.toDouble();
|
||||
_positionAnimation = Tween<double>(
|
||||
begin: currentPosition, end: currentPosition)
|
||||
.animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut))
|
||||
..addListener(() {
|
||||
setState(() {}); // trigger rebuild for CustomPainter
|
||||
});
|
||||
}
|
||||
|
||||
void _onTabTapped(int index) {
|
||||
setState(() {
|
||||
final begin = currentPosition;
|
||||
final end = index.toDouble();
|
||||
_positionAnimation = Tween<double>(begin: begin, end: end).animate(
|
||||
CurvedAnimation(parent: _controller, curve: Curves.easeOut),
|
||||
)..addListener(() {
|
||||
setState(() {});
|
||||
});
|
||||
_controller.forward(from: 0.0);
|
||||
currentPosition = end;
|
||||
selectedIndex = index;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _buildPageContent() {
|
||||
return Center(child: Text('页面 ${titles[selectedIndex]}'));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF011C33),
|
||||
body: IndexedStack(
|
||||
index: selectedIndex,
|
||||
children: pages,
|
||||
),
|
||||
bottomNavigationBar: BezierBottomNavigationBar(
|
||||
selectedIndex: selectedIndex,
|
||||
animatedPosition: _positionAnimation.value,
|
||||
onTap: _onTabTapped,
|
||||
path: path,
|
||||
titles: titles,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -407,6 +407,7 @@ class _MessagePageState extends State<MessagePage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 17.rpx),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -737,4 +737,5 @@ class _MinePageState extends State<MinePage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user