ente/mobile/lib/ui/home/start_backup_hook_widget.dart

68 lines
2.1 KiB
Dart
Raw Normal View History

2023-12-21 07:34:06 +00:00
import "dart:async";
2022-10-20 09:10:17 +00:00
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/generated/l10n.dart';
2022-10-20 09:10:17 +00:00
import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/common/gradient_button.dart';
2023-06-06 09:57:17 +00:00
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
2022-10-20 09:10:17 +00:00
import 'package:photos/utils/navigation_util.dart';
class StartBackupHookWidget extends StatelessWidget {
final Widget headerWidget;
const StartBackupHookWidget({super.key, required this.headerWidget});
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
headerWidget,
Padding(
padding: const EdgeInsets.only(top: 64),
child: Image.asset(
"assets/onboarding_safe.png",
height: 206,
),
),
Text(
S.of(context).noPhotosAreBeingBackedUpRightNow,
2022-10-20 09:10:17 +00:00
style: Theme.of(context)
.textTheme
2023-06-13 06:41:31 +00:00
.bodySmall!
2022-10-20 09:10:17 +00:00
.copyWith(fontFamily: 'Inter-Medium', fontSize: 16),
),
Center(
child: Material(
type: MaterialType.transparency,
child: Container(
width: double.infinity,
height: 64,
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
child: GradientButton(
onTap: () async {
if (LocalSyncService.instance
.hasGrantedLimitedPermissions()) {
2023-12-21 07:34:06 +00:00
unawaited(PhotoManager.presentLimited());
2022-10-20 09:10:17 +00:00
} else {
2023-12-21 07:34:06 +00:00
// ignore: unawaited_futures
2022-10-20 09:10:17 +00:00
routeToPage(
context,
BackupFolderSelectionPage(
buttonText: S.of(context).startBackup,
2022-10-20 09:10:17 +00:00
),
);
}
},
text: S.of(context).startBackup,
2022-10-20 09:10:17 +00:00
),
),
),
),
const Padding(padding: EdgeInsets.all(50)),
],
);
}
}