Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
✨ Add about page
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Mar 20, 2021
1 parent 41c62c7 commit fbe3b1e
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _MyAppState extends State<MyApp> {
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);

return new MaterialApp(
title: 'Notifications pour Pronote ',
title: 'Notifications pour Pronote',
debugShowCheckedModeBanner: false,
theme: new ThemeData(
primarySwatch: colorCustom,
Expand Down
19 changes: 19 additions & 0 deletions lib/pages/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,25 @@ class _LoginPageState extends State<LoginPage> {
return new Scaffold(
appBar: new AppBar(
title: new Text('Notifications pour Pronote'),
actions: <Widget>[
PopupMenuButton<String>(
onSelected: (String value) {
if (value == 'Problèmes de connexion') {

} else {
showAboutAppDialog(context);
}
},
itemBuilder: (BuildContext context){
return ['Problèmes de connexion', 'À propos'].map((String choice){
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
},
)
],
),
body: Stack(
children: <Widget>[_showForm()],
Expand Down
18 changes: 17 additions & 1 deletion lib/widgets/dialogs.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

void showInfoDialog(BuildContext context, {String title, String content}) {
void showInfoDialog(BuildContext context, {String title, String content, List<Widget> actions}) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text(title),
content: new Text(content),
actions: <Widget>[
...(actions ?? []),
new ElevatedButton(
child: new Text("Fermer"),
onPressed: () {
Expand All @@ -18,3 +20,17 @@ void showInfoDialog(BuildContext context, {String title, String content}) {
},
);
}

void _launchURL(_url) async => await canLaunch(_url) ? await launch(_url) : throw 'Could not launch $_url';

void showAboutAppDialog (BuildContext context) {
showInfoDialog(context, title: 'À propos',content: 'Notifications pour Pronote est une application gratuite, open source et sans publicité développée par des étudiants !', actions: [
new ElevatedButton(
style: ButtonStyle(backgroundColor: MaterialStateProperty.all<Color>(Colors.deepOrangeAccent)),
child: new Text("Faire un don"),
onPressed: () {
_launchURL('https://paypal.me/andr0z');
},
)
]);
}
44 changes: 43 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -478,4 +520,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
flutter: ">=1.22.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
settings_ui: ^0.4.0
flutter_launcher_icons: ^0.9.0
geolocator: ^7.0.1
url_launcher: ^6.0.2

dependency_overrides:
plugin_platform_interface: ^2.0.0
Expand Down

0 comments on commit fbe3b1e

Please sign in to comment.