This commit is contained in:
toly
2023-09-22 09:15:11 +08:00
parent d456e3c523
commit e95c34018e
132 changed files with 8527 additions and 17 deletions

View File

@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:iroute/13/02/store/app_state.dart';
import '../route/route_state.dart';
import 'color_add_page.dart';
import '../../../common/components/colors_panel.dart';
import '../../../common/pages/stl_color_page.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
AppState state = AppStateScope.of(context);
return Scaffold(
appBar: AppBar(title:const Text('颜色主页')),
floatingActionButton: FloatingActionButton(
onPressed: _toAddPage,
child: const Icon(Icons.add),
),
body: ColorsPanel(
colors: state.colors,
onSelect: _selectColor,
),
);
}
void _selectColor(Color color){
String value = '#${color.value.toRadixString(16)}';
RouteStateScope.of(context).update('/color/detail/$value');
}
void _toAddPage() async {
RouteStateScope.of(context).update('/color/add');
}
}