2021-12-06 18:31:19 +00:00
|
|
|
part of 'backup_details.dart';
|
|
|
|
|
|
|
|
class _Header extends StatelessWidget {
|
|
|
|
const _Header(
|
|
|
|
{Key? key, required this.providerState, required this.refreshing})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
final StateType providerState;
|
|
|
|
final bool refreshing;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Row(
|
|
|
|
children: [
|
|
|
|
IconStatusMask(
|
|
|
|
status: providerState,
|
|
|
|
child: Icon(
|
|
|
|
BrandIcons.save,
|
|
|
|
size: 40,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 4,
|
|
|
|
horizontal: 2,
|
|
|
|
),
|
|
|
|
child: IconButton(
|
|
|
|
onPressed: refreshing
|
|
|
|
? null
|
|
|
|
: () => {context.read<BackupsCubit>().updateBackups()},
|
|
|
|
icon: const Icon(Icons.refresh_rounded),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 4,
|
|
|
|
horizontal: 2,
|
|
|
|
),
|
|
|
|
child: PopupMenuButton<_PopupMenuItemType>(
|
|
|
|
enabled: providerState != StateType.uninitialized,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
),
|
|
|
|
onSelected: (_PopupMenuItemType result) {
|
|
|
|
switch (result) {
|
|
|
|
case _PopupMenuItemType.reuploadKey:
|
|
|
|
context.read<BackupsCubit>().reuploadKey();
|
|
|
|
break;
|
2021-12-09 03:35:15 +00:00
|
|
|
case _PopupMenuItemType.refetchBackups:
|
|
|
|
context.read<BackupsCubit>().forceUpdateBackups();
|
|
|
|
break;
|
2021-12-06 18:31:19 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
icon: Icon(Icons.more_vert),
|
|
|
|
itemBuilder: (BuildContext context) => [
|
|
|
|
PopupMenuItem<_PopupMenuItemType>(
|
|
|
|
value: _PopupMenuItemType.reuploadKey,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(left: 5),
|
|
|
|
child: Text('providers.backup.reuploadKey'.tr()),
|
|
|
|
),
|
|
|
|
),
|
2021-12-09 03:35:15 +00:00
|
|
|
PopupMenuItem<_PopupMenuItemType>(
|
|
|
|
value: _PopupMenuItemType.refetchBackups,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(left: 5),
|
|
|
|
child: Text('providers.backup.refetchBackups'.tr()),
|
|
|
|
),
|
|
|
|
),
|
2021-12-06 18:31:19 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-09 03:35:15 +00:00
|
|
|
enum _PopupMenuItemType { reuploadKey, refetchBackups }
|