Skip to content

Commit ba0ec1b

Browse files
committed
🚸 Enlarge select indicator size.
Related to #33 .
1 parent 2927920 commit ba0ec1b

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed

lib/src/widget/asset_picker.dart

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ class AssetPicker extends StatelessWidget {
686686
provider.selectedAssets,
687687
builder: (BuildContext _, List<AssetEntity> selectedAssets, Widget __) {
688688
final bool selected = selectedAssets.contains(asset);
689+
final double indicatorSize = Screens.width / gridCount / 3;
689690
return Positioned(
690691
top: 0.0,
691692
right: 0.0,
@@ -701,33 +702,40 @@ class AssetPicker extends StatelessWidget {
701702
provider.selectAsset(asset);
702703
}
703704
},
704-
child: AnimatedContainer(
705-
duration: switchingPathDuration,
706-
margin: EdgeInsets.all(isAppleOS ? 10.0 : 6.0),
707-
width: isAppleOS ? 28.0 : 20.0,
708-
height: isAppleOS ? 28.0 : 20.0,
709-
decoration: BoxDecoration(
710-
border: !selected
711-
? Border.all(color: Colors.white, width: 2.0)
712-
: null,
713-
color: selected ? themeColor : null,
714-
shape: BoxShape.circle,
715-
),
716-
child: AnimatedSwitcher(
705+
child: Container(
706+
margin: EdgeInsets.all(
707+
Screens.width / gridCount / (isAppleOS ? 12.0 : 15.0)),
708+
width: indicatorSize,
709+
height: indicatorSize,
710+
alignment: AlignmentDirectional.topEnd,
711+
child: AnimatedContainer(
717712
duration: switchingPathDuration,
718-
reverseDuration: switchingPathDuration,
719-
child: selected
720-
? isSingleAssetMode
721-
? Icon(Icons.check, size: 18.0)
722-
: Text(
723-
'${selectedAssets.indexOf(asset) + 1}',
724-
style: TextStyle(
725-
fontSize: isAppleOS ? 16.0 : 14.0,
726-
fontWeight:
727-
isAppleOS ? FontWeight.w600 : FontWeight.bold,
728-
),
729-
)
730-
: const SizedBox.shrink(),
713+
width: indicatorSize / (isAppleOS ? 1.25 : 1.5),
714+
height: indicatorSize / (isAppleOS ? 1.25 : 1.5),
715+
decoration: BoxDecoration(
716+
border: !selected
717+
? Border.all(color: Colors.white, width: 2.0)
718+
: null,
719+
color: selected ? themeColor : null,
720+
shape: BoxShape.circle,
721+
),
722+
child: AnimatedSwitcher(
723+
duration: switchingPathDuration,
724+
reverseDuration: switchingPathDuration,
725+
child: selected
726+
? isSingleAssetMode
727+
? Icon(Icons.check, size: 18.0)
728+
: Text(
729+
'${selectedAssets.indexOf(asset) + 1}',
730+
style: TextStyle(
731+
fontSize: isAppleOS ? 16.0 : 14.0,
732+
fontWeight: isAppleOS
733+
? FontWeight.w600
734+
: FontWeight.bold,
735+
),
736+
)
737+
: const SizedBox.shrink(),
738+
),
731739
),
732740
),
733741
),

0 commit comments

Comments
 (0)