Initial commit
This commit is contained in:
37
lib/common/components/colors_panel.dart
Normal file
37
lib/common/components/colors_panel.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorsPanel extends StatelessWidget {
|
||||
final List<Color> colors;
|
||||
final ValueChanged<Color> onSelect;
|
||||
const ColorsPanel({super.key, required this.colors, required this.onSelect});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: colors
|
||||
.asMap()
|
||||
.keys
|
||||
.map((int index) => GestureDetector(
|
||||
onTap: () => onSelect(colors[index]),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: colors[index],
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
child: Text(
|
||||
'$index',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/common/pages/stl_color_page.dart
Normal file
34
lib/common/pages/stl_color_page.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class StlColorPage extends StatelessWidget {
|
||||
final Color color;
|
||||
const StlColorPage({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,),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user