Skip to content

Commit d2fb9f4

Browse files
committed
💄 Adjust colors properties usage.
Related to #32 .
1 parent dc85028 commit d2fb9f4

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

lib/src/widget/asset_picker.dart

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AssetPicker extends StatelessWidget {
3838
),
3939
gridCount = gridCount ?? 4,
4040
themeColor =
41-
pickerTheme?.colorScheme?.primary ?? themeColor ?? C.themeColor,
41+
pickerTheme?.colorScheme?.secondary ?? themeColor ?? C.themeColor,
4242
super(key: key) {
4343
Constants.textDelegate = textDelegate ?? DefaultTextDelegate();
4444
}
@@ -323,8 +323,8 @@ class AssetPicker extends StatelessWidget {
323323
if (_.watch<AssetPickerProvider>().requestType ==
324324
RequestType.audio) {
325325
return ColoredBox(
326-
color: Colors.white12,
327-
child: Center(child: Icon(Icons.audiotrack)),
326+
color: theme.colorScheme.primary.withOpacity(0.12),
327+
child: const Center(child: Icon(Icons.audiotrack)),
328328
);
329329
}
330330

@@ -340,7 +340,9 @@ class AssetPicker extends StatelessWidget {
340340
fit: BoxFit.cover,
341341
);
342342
} else {
343-
return ColoredBox(color: Colors.white12);
343+
return ColoredBox(
344+
color: theme.colorScheme.primary.withOpacity(0.12),
345+
);
344346
}
345347
},
346348
),
@@ -364,8 +366,10 @@ class AssetPicker extends StatelessWidget {
364366
),
365367
Text(
366368
'(${pathEntity.assetCount})',
367-
style:
368-
TextStyle(color: Colors.grey[600], fontSize: 18.0),
369+
style: TextStyle(
370+
color: theme.textTheme.caption.color,
371+
fontSize: 18.0,
372+
),
369373
maxLines: 1,
370374
overflow: TextOverflow.ellipsis,
371375
),
@@ -542,7 +546,7 @@ class AssetPicker extends StatelessWidget {
542546
gradient: LinearGradient(
543547
begin: AlignmentDirectional.bottomCenter,
544548
end: AlignmentDirectional.topCenter,
545-
colors: <Color>[Colors.black45, Colors.transparent],
549+
colors: <Color>[theme.dividerColor, Colors.transparent],
546550
),
547551
),
548552
child: Align(
@@ -619,12 +623,12 @@ class AssetPicker extends StatelessWidget {
619623
gradient: LinearGradient(
620624
begin: AlignmentDirectional.bottomCenter,
621625
end: AlignmentDirectional.topCenter,
622-
colors: <Color>[Colors.black45, Colors.transparent],
626+
colors: <Color>[theme.dividerColor, Colors.transparent],
623627
),
624628
),
625629
child: Row(
626630
children: <Widget>[
627-
Icon(
631+
const Icon(
628632
Icons.videocam,
629633
size: 24.0,
630634
color: Colors.white,
@@ -633,7 +637,8 @@ class AssetPicker extends StatelessWidget {
633637
padding: const EdgeInsets.only(left: 4.0),
634638
child: Text(
635639
Constants.textDelegate.durationIndicatorBuilder(
636-
Duration(seconds: asset.duration)),
640+
Duration(seconds: asset.duration),
641+
),
637642
style: const TextStyle(
638643
color: Colors.white,
639644
fontSize: 16.0,
@@ -670,7 +675,9 @@ class AssetPicker extends StatelessWidget {
670675
},
671676
child: AnimatedContainer(
672677
duration: switchingPathDuration,
673-
color: selected ? Colors.black45 : Colors.black.withOpacity(0.1),
678+
color: selected
679+
? theme.colorScheme.primary.withOpacity(0.45)
680+
: Colors.black.withOpacity(0.1),
674681
),
675682
), // 点击预览同目录下所有资源
676683
);
@@ -718,7 +725,7 @@ class AssetPicker extends StatelessWidget {
718725
reverseDuration: switchingPathDuration,
719726
child: selected
720727
? isSingleAssetMode
721-
? Icon(Icons.check, size: 18.0)
728+
? const Icon(Icons.check, size: 18.0)
722729
: Text(
723730
'${selectedAssets.indexOf(asset) + 1}',
724731
style: TextStyle(
@@ -742,10 +749,7 @@ class AssetPicker extends StatelessWidget {
742749
child: Text(
743750
Constants.textDelegate.loadFailed,
744751
textAlign: TextAlign.center,
745-
style: const TextStyle(
746-
color: Colors.white,
747-
fontSize: 18.0,
748-
),
752+
style: const TextStyle(fontSize: 18.0),
749753
),
750754
);
751755

@@ -837,7 +841,7 @@ class AssetPicker extends StatelessWidget {
837841
),
838842
),
839843
),
840-
Center(child: Icon(Icons.audiotrack)),
844+
const Center(child: Icon(Icons.audiotrack)),
841845
_selectedBackdrop(context, index, asset),
842846
audioIndicator(asset),
843847
],
@@ -951,7 +955,9 @@ class AssetPicker extends StatelessWidget {
951955
'(${provider.selectedAssets.length})'
952956
: Constants.textDelegate.preview,
953957
style: TextStyle(
954-
color: isSelectedNotEmpty ? null : Colors.grey[600],
958+
color: isSelectedNotEmpty
959+
? null
960+
: theme.textTheme.caption.color,
955961
fontSize: 18.0,
956962
),
957963
);
@@ -1018,7 +1024,7 @@ class AssetPicker extends StatelessWidget {
10181024
)
10191025
: IconButton(
10201026
onPressed: Navigator.of(context).maybePop,
1021-
icon: Icon(Icons.close),
1027+
icon: const Icon(Icons.close),
10221028
),
10231029
);
10241030

lib/src/widget/asset_picker_viewer.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
358358
: Constants.textDelegate.confirm,
359359
style: TextStyle(
360360
color: provider.isSelectedNotEmpty
361-
? Colors.white
362-
: Colors.grey[600],
361+
? widget.themeData.textTheme.bodyText1.color
362+
: widget.themeData.textTheme.caption.color,
363363
fontSize: 17.0,
364364
fontWeight: FontWeight.normal,
365365
),
@@ -437,7 +437,10 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
437437
width: 2.0,
438438
)
439439
: null,
440-
color: isSelected ? null : Colors.white54,
440+
color: isSelected
441+
? null
442+
: widget.themeData.colorScheme.surface
443+
.withOpacity(0.54),
441444
),
442445
),
443446
],
@@ -486,7 +489,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
486489
Center(
487490
child: Icon(
488491
Icons.video_library,
489-
color: Colors.white54,
492+
color: widget.themeData.colorScheme.surface.withOpacity(0.54),
490493
),
491494
),
492495
],

0 commit comments

Comments
 (0)