Skip to content

Commit 1229d98

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # lib/src/widget/asset_picker.dart
2 parents ba0ec1b + 62e2b8d commit 1229d98

File tree

5 files changed

+46
-31
lines changed

5 files changed

+46
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# [2.2.1-dev.1]
1+
# [2.2.1-dev.3]
22

33
* Introduce `ColorScheme` for theme details. Fixed #32 .
4+
* Enhance RTL compatibility.
45

56
# [2.2.0+2]
67

lib/src/widget/asset_picker.dart

Lines changed: 27 additions & 18 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
);
@@ -728,6 +735,9 @@ class AssetPicker extends StatelessWidget {
728735
: Text(
729736
'${selectedAssets.indexOf(asset) + 1}',
730737
style: TextStyle(
738+
color: selected
739+
? theme.textTheme.bodyText1.color
740+
: null,
731741
fontSize: isAppleOS ? 16.0 : 14.0,
732742
fontWeight: isAppleOS
733743
? FontWeight.w600
@@ -750,10 +760,7 @@ class AssetPicker extends StatelessWidget {
750760
child: Text(
751761
Constants.textDelegate.loadFailed,
752762
textAlign: TextAlign.center,
753-
style: const TextStyle(
754-
color: Colors.white,
755-
fontSize: 18.0,
756-
),
763+
style: const TextStyle(fontSize: 18.0),
757764
),
758765
);
759766

@@ -845,7 +852,7 @@ class AssetPicker extends StatelessWidget {
845852
),
846853
),
847854
),
848-
Center(child: Icon(Icons.audiotrack)),
855+
const Center(child: Icon(Icons.audiotrack)),
849856
_selectedBackdrop(context, index, asset),
850857
audioIndicator(asset),
851858
],
@@ -959,7 +966,9 @@ class AssetPicker extends StatelessWidget {
959966
'(${provider.selectedAssets.length})'
960967
: Constants.textDelegate.preview,
961968
style: TextStyle(
962-
color: isSelectedNotEmpty ? null : Colors.grey[600],
969+
color: isSelectedNotEmpty
970+
? null
971+
: theme.textTheme.caption.color,
963972
fontSize: 18.0,
964973
),
965974
);
@@ -1026,7 +1035,7 @@ class AssetPicker extends StatelessWidget {
10261035
)
10271036
: IconButton(
10281037
onPressed: Navigator.of(context).maybePop,
1029-
icon: Icon(Icons.close),
1038+
icon: const Icon(Icons.close),
10301039
),
10311040
);
10321041

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
],

lib/src/widget/fixed_appbar.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,16 @@ class FixedAppBarWrapper extends StatelessWidget {
176176
type: MaterialType.transparency,
177177
child: Stack(
178178
children: <Widget>[
179-
Positioned(
179+
Positioned.fill(
180180
top: kToolbarHeight + MediaQuery.of(context).padding.top,
181-
left: 0.0,
182-
right: 0.0,
183-
bottom: 0.0,
184181
child: body,
185182
),
186-
Positioned(top: 0.0, left: 0.0, right: 0.0, child: appBar),
183+
PositionedDirectional(
184+
top: 0.0,
185+
start: 0.0,
186+
end: 0.0,
187+
child: appBar,
188+
),
187189
],
188190
),
189191
);

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wechat_assets_picker
22
description: An assets' picker written in pure Dart which looks like the one in WeChat, support multi asset pick from the device.
3-
version: 2.2.1-dev.1
3+
version: 2.2.1-dev.3
44
homepage: https://github.com/fluttercandies/flutter_wechat_assets_picker
55

66
environment:
@@ -11,9 +11,9 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313

14-
assets_audio_player: ^2.0.1
14+
assets_audio_player: ^2.0.5+2
1515
extended_image: ">=0.9.0 <2.0.0"
1616
flutter_common_exports: ^0.1.0
1717
photo_manager: ">=0.5.3+1 <2.0.0"
18-
provider: ^4.1.2
18+
provider: ^4.1.3
1919
video_player: ">=0.10.11+1 <2.0.0"

0 commit comments

Comments
 (0)