ente/mobile/lib/ui/home/start_backup_hook_widget.dart
2024-03-01 12:25:37 +05:30

68 lines
2.1 KiB
Dart

import "dart:async";
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/generated/l10n.dart';
import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/common/gradient_button.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
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,
style: Theme.of(context)
.textTheme
.bodySmall!
.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()) {
unawaited(PhotoManager.presentLimited());
} else {
// ignore: unawaited_futures
routeToPage(
context,
BackupFolderSelectionPage(
buttonText: S.of(context).startBackup,
),
);
}
},
text: S.of(context).startBackup,
),
),
),
),
const Padding(padding: EdgeInsets.all(50)),
],
);
}
}