Skip to content

Commit 6904233

Browse files
committed
[#68] fix outline issue
1 parent 086fa95 commit 6904233

File tree

1 file changed

+68
-60
lines changed

1 file changed

+68
-60
lines changed

lib/src/material_picker.dart

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -102,66 +102,73 @@ class _MaterialPickerState extends State<MaterialPicker> {
102102

103103
Widget _colorList() {
104104
return Container(
105-
width: _isPortrait ? 60 : null,
106-
height: _isPortrait ? null : 60,
107-
decoration: BoxDecoration(
108-
border: _isPortrait
109-
? Border(right: BorderSide(color: Colors.grey[300]!, width: 1))
110-
: Border(top: BorderSide(color: Colors.grey[300]!, width: 1)),
111-
),
112-
child: ScrollConfiguration(
113-
behavior: ScrollConfiguration.of(context).copyWith(dragDevices: PointerDeviceKind.values.toSet()),
114-
child: ListView(
115-
scrollDirection: _isPortrait ? Axis.vertical : Axis.horizontal,
116-
children: [
117-
_isPortrait
118-
? const Padding(padding: EdgeInsets.only(top: 7))
119-
: const Padding(padding: EdgeInsets.only(left: 7)),
120-
..._colorTypes.map((List<Color> _colors) {
121-
Color _colorType = _colors[0];
122-
return GestureDetector(
123-
onTap: () {
124-
if (widget.onPrimaryChanged != null) widget.onPrimaryChanged!(_colorType);
125-
setState(() => _currentColorType = _colors);
126-
},
127-
child: Container(
128-
color: const Color(0x00000000),
129-
padding:
130-
_isPortrait ? const EdgeInsets.fromLTRB(0, 7, 0, 7) : const EdgeInsets.fromLTRB(7, 0, 7, 0),
131-
child: Align(
132-
child: AnimatedContainer(
133-
duration: const Duration(milliseconds: 300),
134-
width: 25,
135-
height: 25,
136-
decoration: BoxDecoration(
137-
color: _colorType,
138-
shape: BoxShape.circle,
139-
boxShadow: _currentColorType == _colors
140-
? [
141-
_colorType == Theme.of(context).cardColor
142-
? BoxShadow(
143-
color: Colors.grey[300]!,
144-
blurRadius: 10,
145-
)
146-
: BoxShadow(
147-
color: _colorType,
148-
blurRadius: 10,
149-
),
150-
]
151-
: null,
152-
border: _colorType == Theme.of(context).cardColor
153-
? Border.all(color: Colors.grey[300]!, width: 1)
154-
: null,
105+
clipBehavior: Clip.hardEdge,
106+
decoration: const BoxDecoration(),
107+
child: Container(
108+
margin: _isPortrait ? const EdgeInsets.only(right: 10) : const EdgeInsets.only(bottom: 10),
109+
width: _isPortrait ? 60 : null,
110+
height: _isPortrait ? null : 60,
111+
decoration: BoxDecoration(
112+
color: Theme.of(context).cardColor,
113+
boxShadow: [BoxShadow(color: Colors.grey[300]!, blurRadius: 10)],
114+
border: _isPortrait
115+
? Border(right: BorderSide(color: Colors.grey[300]!, width: 1))
116+
: Border(top: BorderSide(color: Colors.grey[300]!, width: 1)),
117+
),
118+
child: ScrollConfiguration(
119+
behavior: ScrollConfiguration.of(context).copyWith(dragDevices: PointerDeviceKind.values.toSet()),
120+
child: ListView(
121+
scrollDirection: _isPortrait ? Axis.vertical : Axis.horizontal,
122+
children: [
123+
_isPortrait
124+
? const Padding(padding: EdgeInsets.only(top: 7))
125+
: const Padding(padding: EdgeInsets.only(left: 7)),
126+
..._colorTypes.map((List<Color> _colors) {
127+
Color _colorType = _colors[0];
128+
return GestureDetector(
129+
onTap: () {
130+
if (widget.onPrimaryChanged != null) widget.onPrimaryChanged!(_colorType);
131+
setState(() => _currentColorType = _colors);
132+
},
133+
child: Container(
134+
color: const Color(0x00000000),
135+
padding:
136+
_isPortrait ? const EdgeInsets.fromLTRB(0, 7, 0, 7) : const EdgeInsets.fromLTRB(7, 0, 7, 0),
137+
child: Align(
138+
child: AnimatedContainer(
139+
duration: const Duration(milliseconds: 300),
140+
width: 25,
141+
height: 25,
142+
decoration: BoxDecoration(
143+
color: _colorType,
144+
shape: BoxShape.circle,
145+
boxShadow: _currentColorType == _colors
146+
? [
147+
_colorType == Theme.of(context).cardColor
148+
? BoxShadow(
149+
color: Colors.grey[300]!,
150+
blurRadius: 10,
151+
)
152+
: BoxShadow(
153+
color: _colorType,
154+
blurRadius: 10,
155+
),
156+
]
157+
: null,
158+
border: _colorType == Theme.of(context).cardColor
159+
? Border.all(color: Colors.grey[300]!, width: 1)
160+
: null,
161+
),
155162
),
156163
),
157164
),
158-
),
159-
);
160-
}),
161-
_isPortrait
162-
? const Padding(padding: EdgeInsets.only(top: 5))
163-
: const Padding(padding: EdgeInsets.only(left: 5)),
164-
],
165+
);
166+
}),
167+
_isPortrait
168+
? const Padding(padding: EdgeInsets.only(top: 5))
169+
: const Padding(padding: EdgeInsets.only(left: 5)),
170+
],
171+
),
165172
),
166173
),
167174
);
@@ -185,19 +192,20 @@ class _MaterialPickerState extends State<MaterialPicker> {
185192
},
186193
child: Container(
187194
color: const Color(0x00000000),
195+
margin: _isPortrait ? const EdgeInsets.only(right: 10) : const EdgeInsets.only(bottom: 10),
188196
padding: _isPortrait ? const EdgeInsets.fromLTRB(0, 7, 0, 7) : const EdgeInsets.fromLTRB(7, 0, 7, 0),
189197
child: Align(
190198
child: AnimatedContainer(
191199
curve: Curves.fastOutSlowIn,
192200
duration: const Duration(milliseconds: 500),
193201
width:
194-
_isPortrait ? (_currentShading == _color ? 250 : 220) : (_currentShading == _color ? 50 : 30),
202+
_isPortrait ? (_currentShading == _color ? 250 : 230) : (_currentShading == _color ? 50 : 30),
195203
height: _isPortrait ? 50 : 220,
196204
decoration: BoxDecoration(
197205
color: _color,
198206
boxShadow: _currentShading == _color
199207
? [
200-
_color == Theme.of(context).cardColor
208+
(_color == Colors.white) || (_color == Colors.black)
201209
? BoxShadow(
202210
color: Colors.grey[300]!,
203211
blurRadius: 10,
@@ -208,7 +216,7 @@ class _MaterialPickerState extends State<MaterialPicker> {
208216
),
209217
]
210218
: null,
211-
border: _color == Theme.of(context).cardColor
219+
border: (_color == Colors.white) || (_color == Colors.black)
212220
? Border.all(color: Colors.grey[300]!, width: 1)
213221
: null,
214222
),

0 commit comments

Comments
 (0)