[UI-Kit] Disable attachment download dialog pop using back button

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-03-02 14:39:02 +05:30
parent 2d5384e48b
commit d2e270e356
@@ -207,65 +207,68 @@ class AttachmentActionsModal extends StatelessWidget {
ValueNotifier<_DownloadProgress> progressNotifier, ValueNotifier<_DownloadProgress> progressNotifier,
) { ) {
final theme = StreamChatTheme.of(context); final theme = StreamChatTheme.of(context);
return ValueListenableBuilder( return WillPopScope(
valueListenable: progressNotifier, onWillPop: () => Future.value(false),
builder: (_, _DownloadProgress progress, __) { child: ValueListenableBuilder(
final value = progress.toProgressIndicatorValue; valueListenable: progressNotifier,
final downloadComplete = value == 1.0; builder: (_, _DownloadProgress progress, __) {
if (value == 1.0) { final value = progress.toProgressIndicatorValue;
Future.delayed( final downloadComplete = value == 1.0;
const Duration(milliseconds: 500), if (value == 1.0) {
Navigator.of(context).pop, Future.delayed(
); const Duration(milliseconds: 500),
} Navigator.of(context).pop,
return Material( );
type: MaterialType.transparency, }
child: Center( return Material(
child: Container( type: MaterialType.transparency,
height: 182, child: Center(
width: 182, child: Container(
decoration: BoxDecoration( height: 182,
borderRadius: BorderRadius.circular(16), width: 182,
color: theme.colorTheme.white, decoration: BoxDecoration(
), borderRadius: BorderRadius.circular(16),
child: Center( color: theme.colorTheme.white,
child: downloadComplete ),
? Container( child: Center(
height: 160, child: downloadComplete
width: 160, ? Container(
child: StreamSvgIcon.check( height: 160,
color: theme.colorTheme.greyGainsboro, width: 160,
), child: StreamSvgIcon.check(
) color: theme.colorTheme.greyGainsboro,
: Container( ),
height: 100, )
width: 100, : Container(
child: Stack( height: 100,
fit: StackFit.expand, width: 100,
children: [ child: Stack(
CircularProgressIndicator( fit: StackFit.expand,
value: value, children: [
strokeWidth: 8.0, CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation( value: value,
theme.colorTheme.accentBlue, strokeWidth: 8.0,
), valueColor: AlwaysStoppedAnimation(
), theme.colorTheme.accentBlue,
Center(
child: Text(
'${progress.toPercentage}%',
style: theme.textTheme.headline.copyWith(
color: theme.colorTheme.grey,
), ),
), ),
), Center(
], child: Text(
'${progress.toPercentage}%',
style: theme.textTheme.headline.copyWith(
color: theme.colorTheme.grey,
),
),
),
],
),
), ),
), ),
), ),
), ),
), );
); },
}, ),
); );
} }