feat(ui): Implement a simple 'About' page

This commit is contained in:
PapaTutuWawa 2023-02-06 17:17:53 +01:00
parent 67531b84f0
commit f7c9e7a6b4
8 changed files with 5245 additions and 2 deletions

View File

@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {

5065
lib/licenses.g.dart Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -1,3 +1,4 @@
const animeListRoute = '/anime/list';
const animeSearchRoute = '/anime/search';
const detailsRoute = '/anime/details';
const aboutRoute = '/about';

View 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,
);
},
);
},
),
);
}
}

View File

@ -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)

View File

@ -197,6 +197,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
dart_pubspec_licenses:
dependency: transitive
description:
name: dart_pubspec_licenses
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
dart_style:
dependency: transitive
description:
@ -272,11 +279,23 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_oss_licenses:
dependency: "direct dev"
description:
name: flutter_oss_licenses
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
freezed:
dependency: "direct dev"
description:
@ -367,7 +386,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5"
version: "0.6.4"
json_annotation:
dependency: "direct main"
description:
@ -695,6 +714,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.8"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.23"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.18"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.14"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.3"
uuid:
dependency: transitive
description:

View File

@ -19,6 +19,7 @@ dependencies:
get_it: ^7.2.0
jikan_api: ^2.0.0
json_annotation: 4.6.0
url_launcher: ^6.1.8
sqflite: ^2.2.4+1
swipeable_tile: ^2.0.0+3
@ -26,6 +27,7 @@ dev_dependencies:
build_runner: ^2.1.11
flutter_launcher_icons: ^0.11.0
flutter_lints: ^2.0.0
flutter_oss_licenses: ^2.0.1
flutter_test:
sdk: flutter
freezed: ^2.1.0+1