✨ About page
This commit is contained in:
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:goatagent/auth.dart';
|
||||
import 'package:goatagent/firebase.dart';
|
||||
import 'package:goatagent/screens/about.dart';
|
||||
import 'package:goatagent/screens/account.dart';
|
||||
import 'package:goatagent/screens/dashboard.dart';
|
||||
import 'package:goatagent/screens/notifications.dart';
|
||||
@ -11,7 +12,13 @@ import 'layouts/navigation.dart';
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
AuthGuard().pickClient();
|
||||
try {
|
||||
await initializeFirebase();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
await AuthGuard().pickClient();
|
||||
|
||||
runApp(GoatAgent());
|
||||
}
|
||||
@ -32,6 +39,10 @@ class GoatAgent extends StatelessWidget {
|
||||
path: '/account',
|
||||
builder: (context, state) => const AccountScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/about',
|
||||
builder: (context, state) => const AboutScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@ -39,34 +50,23 @@ class GoatAgent extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: initializeFirebase(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
return MaterialApp.router(
|
||||
routerConfig: _router,
|
||||
title: 'GoatAgent',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
|
||||
useMaterial3: true,
|
||||
),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Overlay(initialEntries: [
|
||||
OverlayEntry(
|
||||
builder: (context) => Scaffold(
|
||||
body: child,
|
||||
// bottomNavigationBar: const AgentBottomNavigation()
|
||||
bottomNavigationBar: AgentNavigation(router: _router),
|
||||
),
|
||||
)
|
||||
]);
|
||||
},
|
||||
);
|
||||
return MaterialApp.router(
|
||||
routerConfig: _router,
|
||||
title: 'GoatAgent',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
|
||||
useMaterial3: true,
|
||||
),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Overlay(initialEntries: [
|
||||
OverlayEntry(
|
||||
builder: (context) => Scaffold(
|
||||
body: child,
|
||||
// bottomNavigationBar: const AgentBottomNavigation()
|
||||
bottomNavigationBar: AgentNavigation(router: _router),
|
||||
),
|
||||
)
|
||||
]);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
49
lib/screens/about.dart
Normal file
49
lib/screens/about.dart
Normal file
@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class AboutScreen extends StatelessWidget {
|
||||
const AboutScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('About'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('GoatAgent',
|
||||
style: Theme.of(context).textTheme.headlineMedium),
|
||||
Text('Goatworks Official Mobile Helper',
|
||||
style: Theme.of(context).textTheme.bodyLarge),
|
||||
const SizedBox(height: 20),
|
||||
FutureBuilder(
|
||||
future: PackageInfo.fromPlatform(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
var version = snapshot.data!.version;
|
||||
return Text('v$version',
|
||||
style: Theme.of(context).textTheme.bodyLarge);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
),
|
||||
Text('Open sourced under GOLv1', style: Theme.of(context).textTheme.bodyMedium),
|
||||
const SizedBox(height: 10),
|
||||
MaterialButton(
|
||||
onPressed: () async {
|
||||
await launchUrl(Uri.parse('https://smartsheep.studio'));
|
||||
},
|
||||
child: const Text('Official Website'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:goatagent/auth.dart';
|
||||
import 'package:goatagent/widgets/name_card.dart';
|
||||
|
||||
@ -28,57 +29,67 @@ class _AccountScreenState extends State<AccountScreen> {
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: NameCard(
|
||||
onLogin: () async {
|
||||
await AuthGuard().login(context);
|
||||
var authorized = await AuthGuard().isAuthorized();
|
||||
setState(() {
|
||||
isAuthorized = authorized;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: AuthGuard().isAuthorized(),
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
||||
if (snapshot.hasData && snapshot.data == true) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Wrap(
|
||||
spacing: 5,
|
||||
children: [
|
||||
Card(
|
||||
elevation: 0,
|
||||
child: InkWell(
|
||||
splashColor: Colors.indigo.withAlpha(30),
|
||||
onTap: () async {
|
||||
AuthGuard().logout();
|
||||
var authorized =
|
||||
await AuthGuard().isAuthorized();
|
||||
setState(() {
|
||||
isAuthorized = authorized;
|
||||
});
|
||||
},
|
||||
child: const ListTile(
|
||||
leading: Icon(Icons.logout),
|
||||
title: Text('Logout'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Padding(padding: EdgeInsets.only(top: 5));
|
||||
}
|
||||
child: Column(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: NameCard(
|
||||
onLogin: () async {
|
||||
await AuthGuard().login(context);
|
||||
var authorized = await AuthGuard().isAuthorized();
|
||||
setState(() {
|
||||
isAuthorized = authorized;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Wrap(
|
||||
spacing: 5,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: AuthGuard().isAuthorized(),
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
||||
if (snapshot.hasData && snapshot.data == true) {
|
||||
return Card(
|
||||
elevation: 0,
|
||||
child: InkWell(
|
||||
splashColor: Colors.indigo.withAlpha(30),
|
||||
onTap: () async {
|
||||
AuthGuard().logout();
|
||||
var authorized = await AuthGuard().isAuthorized();
|
||||
setState(() {
|
||||
isAuthorized = authorized;
|
||||
});
|
||||
},
|
||||
child: const ListTile(
|
||||
leading: Icon(Icons.logout),
|
||||
title: Text('Logout'),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
),
|
||||
Card(
|
||||
elevation: 0,
|
||||
child: InkWell(
|
||||
splashColor: Colors.indigo.withAlpha(30),
|
||||
onTap: () {
|
||||
GoRouter.of(context).push("/about");
|
||||
},
|
||||
child: const ListTile(
|
||||
leading: Icon(Icons.info_outline),
|
||||
title: Text('About'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user