Skip to content

Commit 262676c

Browse files
committed
🐛 Fix video indicator layout issue
Close #88 .
1 parent ad51486 commit 262676c

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

example/lib/pages/custom_picker_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ class FileAssetPickerBuilder
547547
asset,
548548
);
549549
return Stack(
550+
fit: StackFit.expand,
550551
children: <Widget>[
551552
Positioned.fill(child: builder),
552553
selectIndicator(context, asset),

lib/src/delegates/asset_picker_builder_delegate.dart

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ abstract class AssetPickerBuilderDelegate<A, P> {
150150
/// GIF image type indicator.
151151
/// GIF类型图片指示
152152
Widget gifIndicator(BuildContext context, A asset) {
153-
return Align(
154-
alignment: AlignmentDirectional.bottomStart,
153+
return PositionedDirectional(
154+
start: 0,
155+
bottom: 0,
155156
child: Container(
156157
width: double.maxFinite,
157158
height: 26.0,
@@ -801,6 +802,7 @@ class DefaultAssetPickerBuilderDelegate
801802
}
802803
final AssetEntity asset = provider.currentAssets.elementAt(index);
803804
loader = Stack(
805+
fit: StackFit.expand,
804806
children: <Widget>[
805807
Positioned.fill(
806808
child: RepaintBoundary(child: state.completedWidget),
@@ -1244,36 +1246,39 @@ class DefaultAssetPickerBuilderDelegate
12441246
/// 将指示器的图标和文字设置为 [Colors.white]
12451247
@override
12461248
Widget videoIndicator(BuildContext context, AssetEntity asset) {
1247-
return Container(
1248-
width: double.maxFinite,
1249-
height: 26.0,
1250-
alignment: AlignmentDirectional.bottomStart,
1251-
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2.0),
1252-
decoration: BoxDecoration(
1253-
gradient: LinearGradient(
1254-
begin: AlignmentDirectional.bottomCenter,
1255-
end: AlignmentDirectional.topCenter,
1256-
colors: <Color>[theme.dividerColor, Colors.transparent],
1249+
return PositionedDirectional(
1250+
start: 0,
1251+
bottom: 0,
1252+
child: Container(
1253+
width: double.maxFinite,
1254+
height: 26.0,
1255+
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2.0),
1256+
decoration: BoxDecoration(
1257+
gradient: LinearGradient(
1258+
begin: AlignmentDirectional.bottomCenter,
1259+
end: AlignmentDirectional.topCenter,
1260+
colors: <Color>[theme.dividerColor, Colors.transparent],
1261+
),
12571262
),
1258-
),
1259-
child: Row(
1260-
crossAxisAlignment: CrossAxisAlignment.center,
1261-
children: <Widget>[
1262-
const Icon(Icons.videocam, size: 24.0, color: Colors.white),
1263-
Padding(
1264-
padding: const EdgeInsets.only(left: 4.0),
1265-
child: Text(
1266-
Constants.textDelegate.durationIndicatorBuilder(
1267-
Duration(seconds: asset.duration),
1268-
),
1269-
style: const TextStyle(color: Colors.white, fontSize: 16.0),
1270-
strutStyle: const StrutStyle(
1271-
forceStrutHeight: true,
1272-
height: 1.4,
1263+
child: Row(
1264+
crossAxisAlignment: CrossAxisAlignment.center,
1265+
children: <Widget>[
1266+
const Icon(Icons.videocam, size: 24.0, color: Colors.white),
1267+
Padding(
1268+
padding: const EdgeInsets.only(left: 4.0),
1269+
child: Text(
1270+
Constants.textDelegate.durationIndicatorBuilder(
1271+
Duration(seconds: asset.duration),
1272+
),
1273+
style: const TextStyle(color: Colors.white, fontSize: 16.0),
1274+
strutStyle: const StrutStyle(
1275+
forceStrutHeight: true,
1276+
height: 1.4,
1277+
),
12731278
),
12741279
),
1275-
),
1276-
],
1280+
],
1281+
),
12771282
),
12781283
);
12791284
}

0 commit comments

Comments
 (0)