Skip to content

Commit

Permalink
feat: add did storage and tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman committed Dec 29, 2023
1 parent 1742c13 commit bf0e880
Show file tree
Hide file tree
Showing 20 changed files with 375 additions and 188 deletions.
1 change: 1 addition & 0 deletions frontend/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ analyzer:

linter:
rules:
- prefer_single_quotes
19 changes: 19 additions & 0 deletions frontend/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
PODS:
- Flutter (1.0.0)
- flutter_secure_storage (6.0.0):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
Expand Down
19 changes: 19 additions & 0 deletions frontend/lib/features/account/account_did_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_starter/features/account/account_providers.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

class AccountDidPage extends HookConsumerWidget {
const AccountDidPage({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final did = ref.watch(didProvider);

return Scaffold(
appBar: AppBar(title: const Text('My DID')),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Center(child: SelectableText(did))),
);
}
}
27 changes: 27 additions & 0 deletions frontend/lib/features/account/account_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:flutter_starter/features/account/account_did_page.dart';

class AccountPage extends StatelessWidget {
const AccountPage({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Account')),
body: ListView(
children: [
ListTile(
title: const Text('My DID'),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const AccountDidPage(),
),
);
}),
],
),
);
}
}
3 changes: 3 additions & 0 deletions frontend/lib/features/account/account_providers.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';

final didProvider = Provider<String>((ref) => throw UnimplementedError());
4 changes: 2 additions & 2 deletions frontend/lib/features/app/app.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_starter/features/auth/welcome_page.dart';
import 'package:flutter_starter/features/app/app_tabs.dart';
import 'package:flutter_starter/l10n/app_localizations.dart';
import 'package:flutter_starter/shared/theme/theme.dart';

Expand All @@ -12,7 +12,7 @@ class App extends StatelessWidget {
title: 'DIDPay',
theme: lightTheme(context),
darkTheme: darkTheme(context),
home: const WelcomePage(),
home: const AppTabs(),
localizationsDelegates: Loc.localizationsDelegates,
supportedLocales: const [
Locale('en', ''),
Expand Down
15 changes: 8 additions & 7 deletions frontend/lib/features/app/app_tabs.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_starter/features/sample/sample_page.dart';
import 'package:flutter_starter/features/account/account_page.dart';
import 'package:flutter_starter/features/home/home_page.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

class _TabItem {
Expand All @@ -20,14 +21,14 @@ class AppTabs extends HookConsumerWidget {

final tabs = [
_TabItem(
"Tab 1",
const Icon(Icons.numbers),
const SamplePage(title: "Page 1"),
'Home',
const Icon(Icons.home_outlined),
const HomePage(),
),
_TabItem(
"Tab 2",
const Icon(Icons.check),
const SamplePage(title: "Page 2"),
'Account',
const Icon(Icons.person_outlined),
const AccountPage(),
),
];

Expand Down
77 changes: 0 additions & 77 deletions frontend/lib/features/auth/auth_did_page.dart

This file was deleted.

34 changes: 0 additions & 34 deletions frontend/lib/features/auth/auth_widget_page.dart

This file was deleted.

45 changes: 0 additions & 45 deletions frontend/lib/features/auth/welcome_page.dart

This file was deleted.

36 changes: 36 additions & 0 deletions frontend/lib/features/home/home_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter_starter/features/pfis/pfi_providers.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:url_launcher/url_launcher.dart';

class HomePage extends HookConsumerWidget {
const HomePage({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
final pfis = ref.watch(pfisProvider);
return Scaffold(
appBar: AppBar(title: const Text('Home')),
body: ListView(
children: [
...pfis.map(
(e) => ListTile(
title: Text(e.name),
subtitle: Text(e.id),
trailing: const Icon(Icons.chevron_right),
onTap: () {
_launchUrl(e.widgetUrl);
},
),
)
],
),
);
}

Future<void> _launchUrl(String url) async {
if (!await launchUrl(Uri.parse(url))) {
throw Exception('Could not launch $url');
}
}
}
11 changes: 11 additions & 0 deletions frontend/lib/features/pfis/pfi.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Pfi {
final String id;
final String name;
final String widgetUrl;

Pfi({
required this.id,
required this.name,
required this.widgetUrl,
});
}
9 changes: 9 additions & 0 deletions frontend/lib/features/pfis/pfi_providers.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter_starter/features/pfis/pfi.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

final pfisProvider = Provider<List<Pfi>>(
(ref) => [
Pfi(id: 'africa', name: 'Africa', widgetUrl: 'https://tbd.website'),
Pfi(id: 'mexico', name: 'Mexico', widgetUrl: 'https://block.xyz'),
],
);
13 changes: 0 additions & 13 deletions frontend/lib/features/sample/sample_page.dart

This file was deleted.

Loading

0 comments on commit bf0e880

Please sign in to comment.