<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description This is a PR that makes the auth build runnable on the Desktop platform. Below is a screenshot for the same:  Some things to note: - LocalAuth will be bypassed on unsupported platforms (desktop) - Switched to sodium and sodium-libs from flutter_sodium. - QR code library is incompatible with desktop, So I removed access to those pages. - Bumped some dependencies and done some lint fixes - Also add save key option as send file may not help on desktop (related #380) https://github.com/ente-io/auth/assets/41370460/3f3471e8-45f6-4146-88ac-b763d4f38b32 - Update Recovery Key Card UI  So this is a step towards more updated code and better multiplatform support. ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] 🖼️ New icon - [x] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [x] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore --------- Co-authored-by: Neeraj Gupta <254676+ua741@users.noreply.github.com>
104 lines
3.7 KiB
Dart
104 lines
3.7 KiB
Dart
import 'package:ente_auth/l10n/l10n.dart';
|
|
import 'package:ente_auth/theme/ente_theme.dart';
|
|
import 'package:ente_auth/ui/settings/data/import_page.dart';
|
|
import 'package:ente_auth/ui/settings/faq.dart';
|
|
import 'package:ente_auth/utils/navigation_util.dart';
|
|
import 'package:ente_auth/utils/platform_util.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class HomeEmptyStateWidget extends StatelessWidget {
|
|
final VoidCallback? onScanTap;
|
|
final VoidCallback? onManuallySetupTap;
|
|
|
|
const HomeEmptyStateWidget({
|
|
super.key,
|
|
required this.onScanTap,
|
|
required this.onManuallySetupTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = context.l10n;
|
|
return SingleChildScrollView(
|
|
child: Center(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints.tightFor(height: 800, width: 450),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 40),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Image.asset(
|
|
"assets/wallet-front-gradient.png",
|
|
width: 200,
|
|
height: 200,
|
|
),
|
|
Text(
|
|
l10n.setupFirstAccount,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.headlineMedium,
|
|
),
|
|
const SizedBox(height: 64),
|
|
if (PlatformUtil.isMobile())
|
|
SizedBox(
|
|
width: 400,
|
|
child: OutlinedButton(
|
|
onPressed: onScanTap,
|
|
child: Text(l10n.importScanQrCode),
|
|
),
|
|
),
|
|
const SizedBox(height: 18),
|
|
SizedBox(
|
|
width: 400,
|
|
child: OutlinedButton(
|
|
onPressed: onManuallySetupTap,
|
|
child: Text(l10n.importEnterSetupKey),
|
|
),
|
|
),
|
|
const SizedBox(height: 54),
|
|
InkWell(
|
|
onTap: () {
|
|
routeToPage(context, const ImportCodePage());
|
|
},
|
|
child: Text(
|
|
l10n.importCodes,
|
|
textAlign: TextAlign.center,
|
|
style: getEnteTextTheme(context)
|
|
.bodyFaint
|
|
.copyWith(decoration: TextDecoration.underline),
|
|
),
|
|
),
|
|
const SizedBox(height: 18),
|
|
InkWell(
|
|
onTap: () {
|
|
showModalBottomSheet<void>(
|
|
backgroundColor:
|
|
Theme.of(context).colorScheme.background,
|
|
barrierColor: Colors.black87,
|
|
context: context,
|
|
builder: (context) {
|
|
return const FAQQuestionsWidget();
|
|
},
|
|
);
|
|
},
|
|
child: Text(
|
|
l10n.faq,
|
|
textAlign: TextAlign.center,
|
|
style: getEnteTextTheme(context)
|
|
.bodyFaint
|
|
.copyWith(decoration: TextDecoration.underline),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|