💄 Optimized UX
This commit is contained in:
parent
30a237741a
commit
cb7256af23
@ -94,12 +94,16 @@ PODS:
|
||||
- nanopb/encode (= 2.30909.1)
|
||||
- nanopb/decode (2.30909.1)
|
||||
- nanopb/encode (2.30909.1)
|
||||
- package_info_plus (0.4.5):
|
||||
- Flutter
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- PromisesObjC (2.3.1)
|
||||
- PromisesSwift (2.3.1):
|
||||
- PromisesObjC (= 2.3.1)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
- webview_flutter_wkwebview (0.0.1):
|
||||
- Flutter
|
||||
|
||||
@ -110,7 +114,9 @@ DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_appauth (from `.symlinks/plugins/flutter_appauth/ios`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/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`)
|
||||
|
||||
SPEC REPOS:
|
||||
@ -143,8 +149,12 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/flutter_appauth/ios"
|
||||
flutter_secure_storage:
|
||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||
package_info_plus:
|
||||
:path: ".symlinks/plugins/package_info_plus/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"
|
||||
|
||||
@ -167,9 +177,11 @@ SPEC CHECKSUMS:
|
||||
GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe
|
||||
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
|
||||
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
|
||||
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
|
||||
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
|
||||
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
|
||||
PromisesSwift: 28dca69a9c40779916ac2d6985a0192a5cb4a265
|
||||
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
|
||||
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
|
||||
|
||||
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
|
||||
|
@ -74,9 +74,11 @@ class AuthGuard {
|
||||
..addAll(authorizationUrl.queryParameters));
|
||||
|
||||
// Use WebView to get authorization url
|
||||
var responseUrl = await Navigator.of(context).push(MaterialPageRoute(
|
||||
var responseUrl = await Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AuthorizationScreen(authorizationUrl),
|
||||
));
|
||||
),
|
||||
);
|
||||
|
||||
var responseUri = Uri.parse(responseUrl);
|
||||
return await grant
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:goatagent/screens/account.dart';
|
||||
import 'package:goatagent/screens/dashboard.dart';
|
||||
import 'package:goatagent/screens/notifications.dart';
|
||||
|
||||
class AgentNavigation extends StatefulWidget {
|
||||
const AgentNavigation({super.key, required this.router});
|
||||
|
||||
final GoRouter router;
|
||||
const AgentNavigation({super.key});
|
||||
|
||||
static const items = [
|
||||
NavigationDestination(
|
||||
@ -22,20 +22,17 @@ class AgentNavigation extends StatefulWidget {
|
||||
)
|
||||
];
|
||||
|
||||
static const destinations = ["/", "/notifications", "/account"];
|
||||
|
||||
@override
|
||||
State<AgentNavigation> createState() => _AgentNavigationState();
|
||||
}
|
||||
|
||||
class _AgentNavigationState extends State<AgentNavigation> {
|
||||
int _selected = 0;
|
||||
int _view = 0;
|
||||
|
||||
Future<void> initMessage(BuildContext context) async {
|
||||
void navigate() {
|
||||
widget.router.replace("/notifications");
|
||||
setState(() {
|
||||
_selected = 1;
|
||||
_view = 1;
|
||||
});
|
||||
}
|
||||
|
||||
@ -59,16 +56,33 @@ class _AgentNavigationState extends State<AgentNavigation> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return NavigationBar(
|
||||
selectedIndex: _selected,
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
Offstage(
|
||||
offstage: _view != 0,
|
||||
child: const DashboardScreen(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: _view != 1,
|
||||
child: const NotificationScreen(),
|
||||
),
|
||||
Offstage(
|
||||
offstage: _view != 2,
|
||||
child: const AccountScreen(),
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _view,
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
destinations: AgentNavigation.items,
|
||||
onDestinationSelected: (index) {
|
||||
widget.router.replace(AgentNavigation.destinations[index]);
|
||||
setState(() {
|
||||
_selected = index;
|
||||
_view = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -20,54 +20,35 @@ void main() async {
|
||||
|
||||
await AuthGuard().pickClient();
|
||||
|
||||
runApp(GoatAgent());
|
||||
runApp(const GoatAgent());
|
||||
}
|
||||
|
||||
class GoatAgent extends StatelessWidget {
|
||||
final _router = GoRouter(
|
||||
navigatorKey: GlobalKey<NavigatorState>(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => const DashboardScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/notifications',
|
||||
builder: (context, state) => const NotificationScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/account',
|
||||
builder: (context, state) => const AccountScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about',
|
||||
builder: (context, state) => const AboutScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
GoatAgent({super.key});
|
||||
const GoatAgent({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp.router(
|
||||
routerConfig: _router,
|
||||
return MaterialApp(
|
||||
title: 'GoatAgent',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
|
||||
brightness: Brightness.light,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: Colors.indigo,
|
||||
accentColor: Colors.indigoAccent,
|
||||
backgroundColor: Colors.white,
|
||||
brightness: Brightness.light),
|
||||
useMaterial3: true,
|
||||
),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Overlay(initialEntries: [
|
||||
OverlayEntry(
|
||||
builder: (context) => Scaffold(
|
||||
body: child,
|
||||
// bottomNavigationBar: const AgentBottomNavigation()
|
||||
bottomNavigationBar: AgentNavigation(router: _router),
|
||||
darkTheme: ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: Colors.indigo,
|
||||
accentColor: Colors.indigoAccent,
|
||||
backgroundColor: Colors.black12,
|
||||
brightness: Brightness.dark),
|
||||
useMaterial3: true,
|
||||
),
|
||||
)
|
||||
]);
|
||||
},
|
||||
home: const AgentNavigation(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class AuthorizationScreen extends StatelessWidget {
|
||||
class ApplicationScreen extends StatelessWidget {
|
||||
final Uri link;
|
||||
final String title;
|
||||
|
||||
const AuthorizationScreen(this.link, {super.key});
|
||||
const ApplicationScreen({super.key, required this.link, required this.title});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(32.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: AppBar(),
|
||||
)
|
||||
),
|
||||
body: SafeArea(
|
||||
child: WebViewWidget(
|
||||
controller: WebViewController()
|
||||
|
@ -1,10 +1,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:goatagent/screens/application.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'application.dart';
|
||||
|
||||
class DashboardScreen extends StatefulWidget {
|
||||
const DashboardScreen({super.key});
|
||||
|
||||
@ -46,9 +45,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
return Card(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => AuthorizationScreen(
|
||||
Uri.parse(element["link"]),
|
||||
var link = element["link"];
|
||||
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(
|
||||
builder: (context) => ApplicationScreen(
|
||||
link: Uri.parse(link),
|
||||
title: element["name"],
|
||||
),
|
||||
));
|
||||
},
|
||||
|
Reference in New Issue
Block a user