Skip to content

Commit 2390fd8

Browse files
committed
Added info + licenses button
1 parent 9f02cd6 commit 2390fd8

File tree

4 files changed

+79
-17
lines changed

4 files changed

+79
-17
lines changed

app/lib/helpers/helpers.dart

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'dart:async';
22
import 'dart:convert';
33

4+
import 'package:url_launcher/url_launcher.dart';
45
import 'package:cached_network_image/cached_network_image.dart';
56
import 'package:flutter/material.dart';
67
import 'package:http/http.dart' as http;
78

89
const baseUrl = 'https://app.splatoon2.nintendo.net';
10+
const appVersion = '1.1';
911

1012
Future<Map> fetchData(toFetch) async {
1113
var reqHeaders = {'User-Agent': 'Splat2ink App'};
@@ -66,10 +68,8 @@ salmonRunOutCheck(timeStart, timeEnd) {
6668
storeItemCreator(storeData) {
6769
var times = storeData.length;
6870
var listOfCards = <Widget>[];
69-
print(storeData[0]);
7071
for (var i = 0; i < times; i++) {
7172
var data = storeData[i];
72-
print(data);
7373
listOfCards.add(
7474
new Card(
7575
child: new Row(
@@ -133,6 +133,21 @@ weaponCardBuild(weaponArray) {
133133
mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: cardList);
134134
}
135135

136+
void routeBuilder({ BuildContext context, Widget child}) {
137+
showDialog(context: context,
138+
builder: (BuildContext context) => child
139+
);
140+
}
141+
142+
OpenUrl(link) async {
143+
var url = link;
144+
if (await canLaunch(url)) {
145+
await launch(url);
146+
} else {
147+
throw 'Could not launch $url';
148+
}
149+
}
150+
136151
//starCreator(amount) {
137152
// var starList = <Widget>[];
138153
// for (var i = 0; i < amount; i++) {

app/lib/helpers/info_dialog.dart

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import 'package:flutter/material.dart';
2+
import 'helpers.dart';
3+
4+
class InfoDialog extends StatelessWidget {
5+
@override
6+
Widget build(BuildContext context) {
7+
return new AlertDialog(
8+
title: new Row(
9+
children: <Widget>[
10+
new Image.asset('res/icons/squid.png', height: 100.0),
11+
new Padding(padding: new EdgeInsets.only(left: 50.0)),
12+
new Column(
13+
crossAxisAlignment: CrossAxisAlignment.start,
14+
children: <Widget>[
15+
new Text('Splat2ink'),
16+
new Text('Version - ${appVersion}', style: new TextStyle(fontSize: 15.0,),)
17+
],
18+
)
19+
],
20+
),
21+
content: new Text(
22+
'Disclaimer: This app is NOT affiliated with Nintendo. All product names, logos, and brands are property of their respective owners.',
23+
style: new TextStyle(fontSize: 14.0)),
24+
actions: <Widget>[
25+
new FlatButton(onPressed: () {
26+
OpenUrl('https://paypal.me/crazyandroid101');
27+
}, child: new Text('Donate')),
28+
new FlatButton(onPressed: () {
29+
OpenUrl('https://github.com/Cyan101/Splat2ink');
30+
}, child: new Text('Source Code')),
31+
],
32+
);
33+
}
34+
}

app/lib/main.dart

+26-15
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
11
import 'package:flutter/material.dart';
22

3+
import 'helpers/helpers.dart';
4+
import 'helpers/info_dialog.dart';
5+
36
import 'pages/game_modes.dart';
47
import 'pages/salmon_run.dart';
58
import 'pages/store.dart';
69

7-
void main() => runApp(new AppMenu());
8-
9-
10+
void main() {
11+
runApp(new MaterialApp(
12+
theme: ThemeData(primarySwatch: Colors.blue),
13+
title: 'Splat2ink',
14+
color: Color.fromRGBO(29, 85, 211, 1.0),
15+
home: new AppMenu()
16+
));
17+
}
1018

11-
//class AppMenu extends StatefulWidget {
12-
// @override
13-
// createState() => new AppMenuState();
14-
//}
15-
//class AppMenuState extends State<AppMenu> {
19+
class AppMenu extends StatefulWidget {
20+
@override
21+
createState() => new AppMenuState();
22+
}
1623

17-
class AppMenu extends StatelessWidget {
24+
class AppMenuState extends State<AppMenu> {
25+
//class AppMenu extends StatelessWidget {
1826
@override
1927
Widget build(BuildContext context) {
20-
return new MaterialApp(
21-
theme: ThemeData(primarySwatch: Colors.blue),
22-
title: 'Splat2ink',
23-
color: Color.fromRGBO(29, 85, 211, 1.0),
24-
home: new DefaultTabController(
28+
return new DefaultTabController(
2529
length: 3,
2630
child: new Scaffold(
2731
appBar: new AppBar(
32+
actions: <Widget>[
33+
new IconButton(icon: new Icon(Icons.book), onPressed: (){ routeBuilder(context: context,
34+
child: LicensePage(applicationName: 'Splat2ink', applicationVersion: 'v' + appVersion)); } ),
35+
new IconButton(icon: new Icon(Icons.info), onPressed: (){ routeBuilder(context: context, child: InfoDialog()); } )
36+
],
2837
bottom: new TabBar(
2938
tabs: [
3039
new Tab(icon: new Icon(Icons.format_paint)),
@@ -42,7 +51,9 @@ class AppMenu extends StatelessWidget {
4251
],
4352
),
4453
),
45-
),
4654
);
4755
}
4856
}
57+
58+
59+

app/pubspec.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Splat2ink
22
description: Lightweight tool to quickly view the current map rotations in Splatoon 2.
33

44
dependencies:
5+
url_launcher: "^3.0.0"
56
cached_network_image: "^0.4.0"
67
http: "^0.11.3+16"
78
flutter:
@@ -38,6 +39,7 @@ flutter:
3839
- res/icons/salmon_run_alt.png
3940
- res/icons/coin.png
4041
- res/icons/star.png
42+
- res/icons/squid.png
4143

4244
# To add assets to your application, add an assets section here, in
4345
# this "flutter" section, as in:

0 commit comments

Comments
 (0)