feat(ui): Implement a simple 'About' page
This commit is contained in:
5065
lib/licenses.g.dart
Normal file
5065
lib/licenses.g.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ import 'package:anitrack/src/ui/bloc/anime_search_bloc.dart';
|
||||
import 'package:anitrack/src/ui/bloc/details_bloc.dart';
|
||||
import 'package:anitrack/src/ui/bloc/navigation_bloc.dart';
|
||||
import 'package:anitrack/src/ui/constants.dart';
|
||||
import 'package:anitrack/src/ui/pages/about.dart';
|
||||
import 'package:anitrack/src/ui/pages/anime_list.dart';
|
||||
import 'package:anitrack/src/ui/pages/anime_search.dart';
|
||||
import 'package:anitrack/src/ui/pages/details.dart';
|
||||
@@ -83,6 +84,7 @@ class MyApp extends StatelessWidget {
|
||||
case animeListRoute: return AnimeListPage.route;
|
||||
case animeSearchRoute: return AnimeSearchPage.route;
|
||||
case detailsRoute: return DetailsPage.route;
|
||||
case aboutRoute: return AboutPage.route;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const animeListRoute = '/anime/list';
|
||||
const animeSearchRoute = '/anime/search';
|
||||
const detailsRoute = '/anime/details';
|
||||
const aboutRoute = '/about';
|
||||
|
||||
72
lib/src/ui/pages/about.dart
Normal file
72
lib/src/ui/pages/about.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import 'dart:io';
|
||||
import 'package:anitrack/licenses.g.dart';
|
||||
import 'package:anitrack/src/ui/constants.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class AboutPage extends StatelessWidget {
|
||||
AboutPage({
|
||||
super.key,
|
||||
});
|
||||
|
||||
static MaterialPageRoute<dynamic> get route => MaterialPageRoute<dynamic>(
|
||||
builder: (_) => AboutPage(),
|
||||
settings: const RouteSettings(
|
||||
name: aboutRoute,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('About'),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: ossLicenses.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'AniTrack',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await launchUrl(
|
||||
Uri.parse('https://codeberg.org/PapaTutuWawa/anitrack'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
child: Text('Source')
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final dep = ossLicenses[index - 1];
|
||||
if (!dep.isDirectDependency) return Container();
|
||||
|
||||
return ListTile(
|
||||
title: Text(dep.name),
|
||||
onTap: () async {
|
||||
if (dep.repository == null) return;
|
||||
|
||||
await launchUrl(
|
||||
Uri.parse(dep.repository!),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,32 @@ class AnimeListPage extends StatelessWidget {
|
||||
_getPopupButton(context, state),
|
||||
],
|
||||
),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
children: [
|
||||
DrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffcf4aff),
|
||||
),
|
||||
child: Text(
|
||||
'AniTrack',
|
||||
style: TextStyle(
|
||||
color: Color(0xff232323),
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
ListTile(
|
||||
leading: Icon(Icons.info),
|
||||
title: Text('About'),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(aboutRoute);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: PageView(
|
||||
// Prevent swiping between pages
|
||||
// (https://github.com/flutter/flutter/issues/37510#issuecomment-612663656)
|
||||
|
||||
Reference in New Issue
Block a user