Skip to content

Commit

Permalink
Added info to About dialog & Help link
Browse files Browse the repository at this point in the history
  • Loading branch information
YarosMallorca committed Jul 17, 2024
1 parent c712ef5 commit 56a52e7
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 38 additions & 5 deletions lib/components/app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
import 'package:dji_mapper/shared/theme_manager.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';

class MappingAppBar extends StatelessWidget implements PreferredSizeWidget {
class MappingAppBar extends StatefulWidget implements PreferredSizeWidget {
const MappingAppBar({super.key});

@override
State<MappingAppBar> createState() => _MappingAppBarState();

@override
Size get preferredSize => const Size.fromHeight(56.0);
}

class _MappingAppBarState extends State<MappingAppBar> {
String _version = "";

@override
void initState() {
super.initState();
PackageInfo.fromPlatform().then((value) {
setState(() {
_version = "V${value.version} (build ${value.buildNumber})";
});
});
}

@override
Widget build(BuildContext context) {
return Consumer<ThemeManager>(
builder: (context, theme, child) => AppBar(
title: GestureDetector(
onTap: () => showAboutDialog(context: context),
onTap: () => showAboutDialog(
context: context,
applicationVersion: _version,
applicationLegalese: "© 2024 Yaroslav Syubayev",
applicationIcon: Image.asset(
"assets/logo.png",
width: 60,
)),
child: const Text("DJI Mapper")),
elevation: 10,
actions: [
Expand All @@ -34,6 +62,11 @@ class MappingAppBar extends StatelessWidget implements PreferredSizeWidget {
title: Text("GitHub"),
),
),
const PopupMenuItem(
value: "help",
child: ListTile(
leading: Icon(Icons.help_outline),
title: Text("Help loading mission"))),
],
onSelected: (value) {
switch (value) {
Expand All @@ -43,14 +76,14 @@ class MappingAppBar extends StatelessWidget implements PreferredSizeWidget {
case "github":
launchUrl(
Uri.https("github.com", "YarosMallorca/DJI-Mapper"));
case "help":
launchUrl(Uri.https("mavicpilots.com",
"/threads/waypoints-how-to-back-up-export-import.135283"));
}
},
)
],
),
);
}

@override
Size get preferredSize => const Size.fromHeight(56.0);
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
child: DynamicColorBuilder(builder: (lightColorScheme, darkColorScheme) {
return Consumer<ThemeManager>(builder: (context, theme, child) {
return MaterialApp(
title: 'DJI Waypoint Mapping',
title: 'DJI Mapper',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: lightColorScheme ??
Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
url: "https://pub.dev"
source: hosted
version: "8.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
url: "https://pub.dev"
source: hosted
version: "3.0.0"
path:
dependency: "direct main"
description:
Expand Down
4 changes: 4 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies:
url_launcher: ^6.3.0
geolocator: ^11.0.0
dio: ^5.5.0+1
package_info_plus: ^8.0.0

dependency_overrides:
geolocator_android: 4.5.4
Expand All @@ -43,3 +44,6 @@ dev_dependencies:

flutter:
uses-material-design: true

assets:
- assets/logo.png

0 comments on commit 56a52e7

Please sign in to comment.