Merge remote-tracking branch 'origin/app' into app

# Conflicts:
#	pubspec.yaml
This commit is contained in:
toly
2023-10-25 15:05:38 +08:00
33 changed files with 1210 additions and 912 deletions

View File

@@ -7,14 +7,16 @@ import '../../../pages/color/color_detail_page.dart';
import '../../../pages/color/color_page.dart';
import '../../../pages/empty/empty_page.dart';
import '../../../pages/settings/settings_page.dart';
import '../../../pages/user/user_page.dart';
import '../../../pages/counter/counter_page.dart';
import '../../../pages/sort/sort_page.dart';
import '../../../pages/sort/views/sort_page.dart';
import '../transition/fade_transition_page.dart';
import '../../../pages/color/color_add_page.dart';
const List<String> kDestinationsPaths = [
'/color',
'/counter',
'/sort',
'/user',
'/settings',
];
@@ -29,8 +31,9 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
int? get activeIndex {
if(path.startsWith('/color')) return 0;
if(path.startsWith('/counter')) return 1;
if(path.startsWith('/user')) return 2;
if(path.startsWith('/settings')) return 3;
if(path.startsWith('/sort')) return 2;
if(path.startsWith('/user')) return 3;
if(path.startsWith('/settings')) return 4;
return null;
}
@@ -95,9 +98,12 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
child = const CounterPage();
}
if (path == kDestinationsPaths[2]) {
child = const SortPage();
child = SortPage();
}
if (path == kDestinationsPaths[3]) {
child = const UserPage();
}
if (path == kDestinationsPaths[4]) {
child = const SettingPage();
}
return [

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import '../../../pages/sort/sort_setting.dart';
import '../router/app_router_delegate.dart';
import 'app_navigation_rail.dart';
import 'app_top_bar.dart';
@@ -10,6 +11,9 @@ class AppNavigation extends StatelessWidget {
Widget build(BuildContext context) {
double px1 = 1/View.of(context).devicePixelRatio;
return Scaffold(
endDrawer: Drawer(
child: SortSettings(),
),
body: Row(
children: [
const AppNavigationRail(),

View File

@@ -14,6 +14,7 @@ class _AppNavigationRailState extends State<AppNavigationRail> {
final List<MenuMeta> deskNavBarMenus = const [
MenuMeta(label: '颜色板', icon: Icons.color_lens_outlined),
MenuMeta(label: '计数器', icon: Icons.add_chart),
MenuMeta(label: '排序', icon: Icons.sort),
MenuMeta(label: '我的', icon: Icons.person),
MenuMeta(label: '设置', icon: Icons.settings),
];

View File

@@ -1,6 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:iroute/components/toly_ui/button/hover_icon_button.dart';
import 'package:iroute/components/toly_ui/popable/drop_selectable_widget.dart';
import '../../../pages/sort/functions.dart';
import '../../../pages/sort/views/sort_bar.dart';
import '../../../pages/sort/views/sort_button.dart';
import '../router/app_router_delegate.dart';
class AppRouterEditor extends StatefulWidget {
@@ -25,6 +29,9 @@ class _AppRouterEditorState extends State<AppRouterEditor> {
void _onRouteChange() {
_controller.text=router.path;
setState(() {
});
}
@override
@@ -36,29 +43,37 @@ class _AppRouterEditorState extends State<AppRouterEditor> {
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.centerRight,
children: [
SizedBox(
child: CupertinoTextField(
controller: _controller,
style: TextStyle(fontSize: 14),
padding: EdgeInsets.only(left:12,top: 6,bottom: 6,right: 32),
placeholder: '输入路由地址导航',
onSubmitted: widget.onSubmit,
decoration: BoxDecoration(color: Color(0xffF1F2F3),borderRadius: BorderRadius.circular(6)),
print(router.path);
if(router.path=='/sort'){
return SortBar();
}
return SizedBox(
width: 250,
child: Stack(
alignment: Alignment.centerRight,
children: [
SizedBox(
child: CupertinoTextField(
controller: _controller,
style: TextStyle(fontSize: 14),
padding: EdgeInsets.only(left:12,top: 6,bottom: 6,right: 32),
placeholder: '输入路由地址导航',
onSubmitted: widget.onSubmit,
decoration: BoxDecoration(color: Color(0xffF1F2F3),borderRadius: BorderRadius.circular(6)),
),
),
),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: HoverIconButton(
icon: Icons.directions_outlined,
defaultColor: Color(0xff68696B),
onPressed:()=>widget.onSubmit?.call(_controller.text),
size: 20
),
)
],
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: HoverIconButton(
icon: Icons.directions_outlined,
defaultColor: Color(0xff68696B),
onPressed:()=>widget.onSubmit?.call(_controller.text),
size: 20
),
)
],
),
);
}
}

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:iroute/components/components.dart';
import '../../../pages/sort/functions.dart';
import '../router/app_router_delegate.dart';
import 'app_router_editor.dart';
@@ -20,7 +21,7 @@ class AppTopBar extends StatelessWidget {
child: Row(children: [
const Spacer(),
SizedBox(
width: 250,
// width: 200,
child: AppRouterEditor(
onSubmit: (path) => router.path = path,
)),
@@ -52,6 +53,7 @@ Map<String, String> kRouteLabelMap = {
'/color/detail': '颜色详情',
'/counter': '计数器',
'/user': '我的',
'/sort': '可视化排序',
'/settings': '系统设置',
};