v3
This commit is contained in:
102
lib/v2/pages/color/color_add_page.dart
Normal file
102
lib/v2/pages/color/color_add_page.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
|
||||
class ColorAddPage extends StatefulWidget {
|
||||
const ColorAddPage({super.key});
|
||||
|
||||
@override
|
||||
State<ColorAddPage> createState() => _ColorAddPageState();
|
||||
}
|
||||
|
||||
class _ColorAddPageState extends State<ColorAddPage> {
|
||||
late Color _color;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_color = randomColor;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String text = '# ${_color.value.toRadixString(16)}';
|
||||
return Scaffold(
|
||||
bottomNavigationBar: Container(
|
||||
margin: EdgeInsets.only(right:20,bottom: 20),
|
||||
// color: Colors.redAccent,
|
||||
child: Row(
|
||||
textDirection:TextDirection.rtl,
|
||||
children: [
|
||||
ElevatedButton(onPressed: (){
|
||||
Navigator.of(context).pop(_color);
|
||||
|
||||
}, child: Text('添加')),
|
||||
SizedBox(width: 12,),
|
||||
OutlinedButton(onPressed: (){
|
||||
Navigator.of(context).pop();
|
||||
}, child: Text('取消')),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: Text(text,style: TextStyle(color: _color,fontSize: 24,letterSpacing: 4),)),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: Icon(
|
||||
Icons.sell_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: _color,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ColorPicker(
|
||||
colorPickerWidth:200,
|
||||
// enableAlpha: false,
|
||||
displayThumbColor:true,
|
||||
pickerColor: _color,
|
||||
paletteType: PaletteType.hueWheel,
|
||||
onColorChanged: changeColor,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Random _random = Random();
|
||||
|
||||
Color get randomColor {
|
||||
return Color.fromARGB(
|
||||
255,
|
||||
_random.nextInt(256),
|
||||
_random.nextInt(256),
|
||||
_random.nextInt(256),
|
||||
);
|
||||
}
|
||||
|
||||
void _selectColor() {
|
||||
Navigator.of(context).pop(_color);
|
||||
}
|
||||
|
||||
void changeColor(Color value) {
|
||||
_color = value;
|
||||
setState(() {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
34
lib/v2/pages/color/color_detail_page.dart
Normal file
34
lib/v2/pages/color/color_detail_page.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class ColorDetailPage extends StatelessWidget {
|
||||
final Color color;
|
||||
const ColorDetailPage({super.key, required this.color});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
const TextStyle style = TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white
|
||||
);
|
||||
String text = '# ${color.value.toRadixString(16)}';
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
systemOverlayStyle: SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.light
|
||||
),
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleTextStyle:TextStyle(color: Colors.white,fontSize: 18) ,
|
||||
backgroundColor: color,
|
||||
title: Text('颜色界面',),),
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
color: color,
|
||||
child: Text(text ,style: style,),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
48
lib/v2/pages/color/color_page.dart
Normal file
48
lib/v2/pages/color/color_page.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:iroute/components/project/colors_panel.dart';
|
||||
import '../../app/navigation/app_router_delegate.dart';
|
||||
|
||||
class ColorPage extends StatefulWidget {
|
||||
const ColorPage({super.key});
|
||||
|
||||
@override
|
||||
State<ColorPage> createState() => _ColorPageState();
|
||||
}
|
||||
|
||||
class _ColorPageState extends State<ColorPage> {
|
||||
final List<Color> _colors = [
|
||||
Colors.red, Colors.black, Colors.blue, Colors.green, Colors.orange,
|
||||
Colors.pink, Colors.purple, Colors.indigo, Colors.amber, Colors.cyan,
|
||||
Colors.redAccent, Colors.grey, Colors.blueAccent, Colors.greenAccent, Colors.orangeAccent,
|
||||
Colors.pinkAccent, Colors.purpleAccent, Colors.indigoAccent, Colors.amberAccent, Colors.cyanAccent,
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// appBar: AppBar(title:const Text('颜色主页')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _toAddPage,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: ColorsPanel(
|
||||
colors: _colors,
|
||||
onSelect: _selectColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _selectColor(Color color){
|
||||
String value = color.value.toRadixString(16);
|
||||
router.path = '/color/detail?color=$value';
|
||||
}
|
||||
|
||||
void _toAddPage() async {
|
||||
Color? color = await router.changePathForResult('/color/add');
|
||||
if (color != null) {
|
||||
setState(() {
|
||||
_colors.add(color);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
43
lib/v2/pages/counter/counter_page.dart
Normal file
43
lib/v2/pages/counter/counter_page.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CounterPage extends StatefulWidget {
|
||||
const CounterPage({super.key});
|
||||
|
||||
@override
|
||||
State<CounterPage> createState() => _CounterPageState();
|
||||
}
|
||||
|
||||
class _CounterPageState extends State<CounterPage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text(
|
||||
'You have pushed the button this many times:',
|
||||
),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
30
lib/v2/pages/empty/empty_page.dart
Normal file
30
lib/v2/pages/empty/empty_page.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EmptyPage extends StatelessWidget {
|
||||
const EmptyPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('界面走丢了'),
|
||||
),
|
||||
body: Scaffold(
|
||||
body: Center(
|
||||
child: Wrap(
|
||||
spacing: 16,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
direction: Axis.vertical,
|
||||
children: [
|
||||
Icon(Icons.nearby_error,size: 64, color: Colors.grey),
|
||||
Text(
|
||||
'404 界面丢失',
|
||||
style: TextStyle(fontSize: 24, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
11
lib/v2/pages/settings/settings_page.dart
Normal file
11
lib/v2/pages/settings/settings_page.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SettingPage extends StatelessWidget {
|
||||
const SettingPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body:Center(child: Text('SettingPage')));
|
||||
}
|
||||
}
|
||||
11
lib/v2/pages/user/user_page.dart
Normal file
11
lib/v2/pages/user/user_page.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserPage extends StatelessWidget {
|
||||
const UserPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body:Center(child: Text('UserPage')));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user