diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart deleted file mode 100644 index d8df9501..00000000 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart +++ /dev/null @@ -1,45 +0,0 @@ - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_tabbar.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/titleAppBar.dart'; -import '../../../../../translations/trans_lib.dart'; -import '../../../../lockMian/entity/lockListInfo_entity.dart'; - -class PasswordKeyManagePage extends StatefulWidget { - const PasswordKeyManagePage({Key? key}) : super(key: key); - - @override - State createState() => _PasswordKeyManagePageState(); -} - -class _PasswordKeyManagePageState extends State { - var index = 0; - late LockListInfoItemEntity keyInfo; - - @override - Widget build(BuildContext context) { - dynamic obj = ModalRoute.of(context)?.settings.arguments; - if (obj != null && (obj["keyInfo"] != null)) { - keyInfo = obj["keyInfo"]; - } - - return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.getPassword!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: Column( - children: [ - PasswordKeyManageTabbarPage( - initialIndex: index, - keyInfo: keyInfo, - ), - ], - ), - ); - } -} diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_tabbar.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_tabbar.dart deleted file mode 100644 index 6e29e1a8..00000000 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_tabbar.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; - -import '../../../../../app_settings/app_colors.dart'; -import '../../../../../tools/CustomUnderlineTabIndicator.dart'; -import '../../../../../translations/trans_lib.dart'; -import '../passwordKey_perpetual_page.dart'; - -class PasswordKeyManageTabbarPage extends StatefulWidget { - var initialIndex = 1; - final LockListInfoItemEntity keyInfo; - - PasswordKeyManageTabbarPage( - {Key? key, required this.initialIndex, required this.keyInfo}) - : super(key: key); - @override - State createState() => - _PasswordKeyManageTabbarPageState(); -} - -class _PasswordKeyManageTabbarPageState extends State with SingleTickerProviderStateMixin { - late TabController _tabController; - - final List _itemTabs = [ - ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "0"), - ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "1"), - ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"), - ItemView(title: TranslationLoader.lanKeys!.custom!.tr, type: "3"), - ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "4"), - ItemView(title: TranslationLoader.lanKeys!.clearAll!.tr, type: "5"), - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - _tabController = TabController( - vsync: this, - length: _itemTabs.length, - initialIndex: widget.initialIndex); - - _tabController.addListener(() { - if (_tabController.animation!.value==_tabController.index){ - FocusScope.of(context).requestFocus(FocusNode()); - } - }); - // _tabController.addListener(handleTabIndex); - } - - // int handleTabIndex() { - // // 获取当前选定的标签索引 - // int currentIndex = _tabController.index; - // // 根据索引可以得知用户点击了哪个 item - // eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex)); - // return currentIndex; - // } - - @override - Widget build(BuildContext context) { - return Expanded( - child: Column( - children: [ - _tabBar(), - _pageWidget(), - ], - )); - } - - TabBar _tabBar() { - return TabBar( - controller: _tabController, - onTap: (index){ - FocusScope.of(context).requestFocus(FocusNode()); - }, - tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), - isScrollable: true, - indicatorColor: Colors.red, - unselectedLabelColor: Colors.black, - unselectedLabelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - ), - automaticIndicatorColorAdjustment: true, - labelColor: AppColors.mainColor, - labelStyle: TextStyle( - color: AppColors.mainColor, - fontSize: 24.sp, - fontWeight: FontWeight.w600), - indicator: CustomUnderlineTabIndicator( - borderSide: BorderSide(color: AppColors.mainColor, width: 4.w), - strokeCap: StrokeCap.round, - width: 30.w), - ); - } - - Tab _tab(ItemView item) { - return Tab( - // text: item.title, - child: Container( - // width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12, - // margin: EdgeInsets.all(10.w), - // color: Colors.red, - child: Text( - item.title, - textAlign: TextAlign.center, - ), - ), - ); - } - - Widget _pageWidget() { - return Expanded( - child: TabBarView( - controller: _tabController, - children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage()).toList(), - ), - ); - } -} - -class ItemView { - const ItemView({required this.title, required this.type}); - - final String title; - final String type; -}