Browse Source

Add about page to Fluent UI

master
Kenneth Bruen 2 years ago
parent
commit
1269a93624
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 5
      CHANGELOG.txt
  2. 216
      codemagic.yaml
  3. 5
      lib/pages/about/about_page.dart
  4. 4
      lib/pages/about/about_page_cupertino.dart
  5. 140
      lib/pages/about/about_page_fluent.dart
  6. 6
      lib/pages/about/about_page_material.dart
  7. 8
      linux/infotren.desktop
  8. 39
      linux/install.sh
  9. 2
      pubspec.yaml

5
CHANGELOG.txt

@ -1,3 +1,8 @@
v2.7.10
Add about page to Fluent UI.
Add settings page, allowing changing between UIs.
Add touch scrolling on Linux.
v2.7.9
Add Fluent UI for Windows and Linux.
Add split view in landscape when viewing a train.

216
codemagic.yaml

File diff suppressed because one or more lines are too long

5
lib/pages/about/about_page.dart

@ -3,6 +3,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:info_tren/api/releases.dart';
import 'package:info_tren/models.dart';
import 'package:info_tren/pages/about/about_page_cupertino.dart';
import 'package:info_tren/pages/about/about_page_fluent.dart';
import 'package:info_tren/pages/about/about_page_material.dart';
import 'package:info_tren/providers.dart';
import 'package:package_info_plus/package_info_plus.dart';
@ -21,6 +22,8 @@ class AboutPage extends ConsumerWidget {
return const AboutPageMaterial();
case UiDesign.CUPERTINO:
return const AboutPageCupertino();
case UiDesign.FLUENT:
return const AboutPageFluent();
default:
throw UnmatchedUiDesignException(uiDesign);
}
@ -31,7 +34,7 @@ abstract class AboutPageShared extends StatefulWidget {
const AboutPageShared({super.key});
}
abstract class AboutPageState extends State<AboutPageShared> {
abstract class AboutPageState<T extends AboutPageShared> extends State<T> {
static const String download = String.fromEnvironment('DOWNLOAD');
final String pageTitle = 'Despre aplicație';

4
lib/pages/about/about_page_cupertino.dart

@ -3,14 +3,14 @@ import 'package:info_tren/components/cupertino_divider.dart';
import 'package:info_tren/pages/about/about_page.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutPageCupertino extends StatefulWidget {
class AboutPageCupertino extends AboutPageShared {
const AboutPageCupertino({super.key});
@override
State<AboutPageShared> createState() => AboutPageStateCupertino();
}
class AboutPageStateCupertino extends AboutPageState {
class AboutPageStateCupertino extends AboutPageState<AboutPageCupertino> {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(

140
lib/pages/about/about_page_fluent.dart

@ -0,0 +1,140 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/services.dart';
import 'package:info_tren/pages/about/about_page.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutPageFluent extends AboutPageShared {
const AboutPageFluent({super.key});
@override
State<AboutPageShared> createState() => AboutPageStateFluent();
}
class AboutPageStateFluent extends AboutPageState<AboutPageFluent> {
@override
Widget build(BuildContext context) {
return NavigationView(
appBar: NavigationAppBar(
title: Text(pageTitle),
),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Text(
'Info Tren',
style: FluentTheme.of(context).typography.display,
),
),
if (packageInfo != null)
Center(
child: Text(
packageInfo!.packageName,
style: FluentTheme.of(context).typography.caption,
),
),
// ListTile(
// title: Text(versionTitleText),
// subtitle: localChangelog.isEmpty ? null : Text(localChangelog.first.title),
// ),
const Divider(),
for (final log in mergedChangelogs) ...[
Padding(
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Text(
log.version.toString(),
style: FluentTheme.of(context).typography.title,
),
),
if (localChangelog.isNotEmpty && log.version == localChangelog.first.version)
Container(
decoration: BoxDecoration(
border: Border.all(
color: FluentTheme.of(context).inactiveColor,
width: 1,
),
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
currentVersionText,
style: const TextStyle(
inherit: true,
),
),
),
),
if (remoteChangelog.isNotEmpty && log.version == remoteChangelog.first.version && (localChangelog.isEmpty || localChangelog.first.version != log.version))
Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
width: 1,
),
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
latestVersionText,
style: TextStyle(
inherit: true,
color: Colors.green,
),
),
),
),
if (AboutPageState.download == 'apk' && log.apkLink != null)
GestureDetector(
onSecondaryTap: () {
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
// ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
// content: Text('Link copied to clipboard'),
// ));
},
onLongPress: () {
Clipboard.setData(ClipboardData(text: log.apkLink!.toString()));
// ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
// content: Text('Link copied to clipboard'),
// ));
},
onTap: () {
launchUrl(
log.apkLink!,
mode: LaunchMode.externalApplication,
);
},
behavior: HitTestBehavior.translucent,
child: const Tooltip(
message: 'Download APK',
child: Padding(
padding: EdgeInsets.all(4),
child: Icon(FluentIcons.download),
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: log.description,
),
),
),
],
],
),
),
);
}
}

6
lib/pages/about/about_page_material.dart

@ -3,14 +3,14 @@ import 'package:flutter/services.dart';
import 'package:info_tren/pages/about/about_page.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutPageMaterial extends StatefulWidget {
class AboutPageMaterial extends AboutPageShared {
const AboutPageMaterial({super.key});
@override
State<AboutPageShared> createState() => AboutPageStateMaterial();
}
class AboutPageStateMaterial extends AboutPageState {
class AboutPageStateMaterial extends AboutPageState<AboutPageMaterial> {
@override
Widget build(BuildContext context) {
return Scaffold(
@ -138,4 +138,4 @@ class AboutPageStateMaterial extends AboutPageState {
),
);
}
}
}

8
linux/infotren.desktop

@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Info Tren
Comment=
Exec=
Icon=
Terminal=False

39
linux/install.sh

@ -0,0 +1,39 @@
#! /bin/sh
install_dir="$1"
if [ -z "$install_dir" ]; then
echo "Please specify a directory to install InfoTren to."
echo "Example:"
echo " $0 ~/infotren"
exit 3
fi
if [ ! -d "$install_dir" ]; then
if [ -d $(dirname "$install_dir") ]; then
mkdir "$install_dir"
else
echo "$install_dir doesn't exist. Please specify a directory to install InfoTren to."
echo "Example:"
echo " $0 ~/infotren"
exit 1
fi
fi
if [ ! -f ./infotren.desktop ]; then
if [ -f "$(dirname $0)/infotren.desktop" ]; then
cd "$(dirname $0)"
else
echo "Run this script from inside the infotren directory."
exit 2
fi
fi
echo "Installing InfoTren to $install_dir"
cp -r . "$install_dir"
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME=~/.local/share
fi
if [ ! -d "$XDG_DATA_HOME/applications" ]; then
mkdir -p "$XDG_DATA_HOME/applications"
fi
echo "Installing infotren.desktop to $XDG_DATA_HOME/applications/infotren.desktop"
cat infotren.desktop | sed "s|Exec=|Exec=$install_dir/info_tren|g" > "$XDG_DATA_HOME/applications/infotren.desktop"

2
pubspec.yaml

@ -11,7 +11,7 @@ description: O aplicație de vizualizare a datelor puse la dispoziție de Inform
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.7.9
version: 2.7.10
environment:
sdk: ">=2.17.0 <3.0.0"

Loading…
Cancel
Save