选择线条颜色

This commit is contained in:
toly
2023-05-09 08:41:11 +08:00
parent 2f9e47cddc
commit d3b48e094c

View File

@@ -34,15 +34,15 @@ class _PaperState extends State<Paper> {
Colors.purple, Colors.purple,
Colors.pink, Colors.pink,
// Colors.grey, Colors.grey,
// Colors.redAccent, Colors.redAccent,
// Colors.orangeAccent, Colors.orangeAccent,
// Colors.yellowAccent, Colors.yellowAccent,
// Colors.greenAccent, Colors.greenAccent,
// Colors.blueAccent, Colors.blueAccent,
// Colors.indigoAccent, Colors.indigoAccent,
// Colors.purpleAccent, Colors.purpleAccent,
// Colors.pinkAccent, Colors.pinkAccent,
]; ];
// 支持的线粗 // 支持的线粗
@@ -55,7 +55,6 @@ class _PaperState extends State<Paper> {
onClear: _showClearDialog, onClear: _showClearDialog,
), ),
body: Stack( body: Stack(
alignment: Alignment.bottomLeft,
children: [ children: [
GestureDetector( GestureDetector(
onPanStart: _onPanStart, onPanStart: _onPanStart,
@@ -65,23 +64,26 @@ class _PaperState extends State<Paper> {
child: ConstrainedBox(constraints: const BoxConstraints.expand()), child: ConstrainedBox(constraints: const BoxConstraints.expand()),
), ),
), ),
Positioned(
bottom: 40,
child: ColorSelector(
supportColors: supportColors,
activeIndex: _activeColorIndex,
onSelect: _onSelectColor,
),
),
Positioned( Positioned(
bottom: 0, bottom: 0,
right: 10, width: MediaQuery.of(context).size.width,
child: StorkWidthSelector( child: Row(
supportStorkWidths: supportStorkWidths, children: [
color: supportColors[_activeColorIndex], Expanded(
activeIndex: _activeStorkWidthIndex, child: ColorSelector(
onSelect: _onSelectStorkWidth, supportColors: supportColors,
) activeIndex: _activeColorIndex,
onSelect: _onSelectColor,
),
),
StorkWidthSelector(
supportStorkWidths: supportStorkWidths,
color: supportColors[_activeColorIndex],
activeIndex: _activeStorkWidthIndex,
onSelect: _onSelectStorkWidth,
),
],
),
), ),
], ],
), ),