Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit d9e812e

Browse files
committed
added Terms of service notice
1 parent 197f465 commit d9e812e

File tree

11 files changed

+321
-122
lines changed

11 files changed

+321
-122
lines changed

.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"connectivity","dependencies":[]},{"name":"flutter_keyboard_visibility","dependencies":[]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"shared_preferences","dependencies":[]},{"name":"webview_flutter","dependencies":[]}]}
1+
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"connectivity","dependencies":[]},{"name":"flutter_keyboard_visibility","dependencies":[]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"shared_preferences","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"webview_flutter","dependencies":[]}]}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ Final tuches
4949
- add sk locatization ✔
5050
- add skin changing ✔
5151
- add some animations
52-
- add legal notice
53-
- agree with imhd rights
54-
- agree with gmaps rights
55-
- agree with licence
52+
- add legal notice ✔
53+
- agree with gmaps rights ✔
54+
- agree with licence ✔
5655
- cloud save favourites like duckduckgo
5756

lib/Actual.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class _ActualPageState extends State<ActualPage> {
5656
? _isLoading
5757
? CircularProgressIndicator()
5858
: WebviewScaffold(
59-
url: url,
59+
url: tableThemeInt == 3 ? Theme.of(context).brightness == Brightness.dark ? (baseUrl + "0") : (baseUrl + "1"): url,
6060
geolocationEnabled: true,
6161
)
6262
: Center(

lib/AllStops.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:http/http.dart' as http;
77
import 'dart:convert';
88
import 'dart:io';
99

10-
import 'widgets/webview.dart';
10+
import 'widgets/stopwebview.dart';
1111
import 'widgets/stopList.dart';
1212
import 'widgets/settings.dart';
1313
import 'locale/locales.dart';

lib/NearMe.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:http/http.dart' as http;
88
import 'dart:convert';
99
import 'dart:io';
1010

11-
import 'widgets/webview.dart';
11+
import 'widgets/stopwebview.dart';
1212
import 'widgets/stopList.dart';
1313
import 'locale/locales.dart';
1414

lib/main.dart

Lines changed: 152 additions & 67 deletions
Large diffs are not rendered by default.

lib/widgets/settings.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class _SettingsState extends State<Settings> {
3131
DropdownPreference(
3232
'Table theme',
3333
'tableTheme',
34-
defaultVal: 'Light',
35-
values: ['Light', 'Dark', 'Blue'],
34+
defaultVal: 'Auto',
35+
values: ['Auto', 'Light', 'Dark', 'Blue'],
3636
onChange: (value) async{
3737
SharedPreferences prefs = await SharedPreferences.getInstance();
3838
setState(() {
@@ -47,6 +47,9 @@ class _SettingsState extends State<Settings> {
4747
case 'Blue':
4848
prefs.setInt('tableThemeInt', 2);
4949
break;
50+
case 'Auto':
51+
prefs.setInt('tableThemeInt', 3);
52+
break;
5053
}
5154
print(prefs.getInt('tableThemeInt'));
5255
});

lib/widgets/stopwebview.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:webview_flutter/webview_flutter.dart';
3+
import 'package:shared_preferences/shared_preferences.dart';
4+
5+
import 'stopList.dart';
6+
7+
class StopWebView extends StatefulWidget {
8+
final Stop stop;
9+
StopWebView(this.stop);
10+
@override
11+
StopWebViewState createState() => StopWebViewState(stop);
12+
}
13+
14+
class StopWebViewState extends State<StopWebView> {
15+
int tableThemeInt;
16+
bool _isLoading = true;
17+
var url;
18+
19+
_getPrefs() async {
20+
SharedPreferences prefs = await SharedPreferences.getInstance();
21+
setState(() {
22+
tableThemeInt = prefs.getInt('tableThemeInt');
23+
url = stop.url + tableThemeInt.toString();
24+
print(url);
25+
_isLoading = false;
26+
});
27+
}
28+
29+
@override
30+
void initState() {
31+
_getPrefs();
32+
super.initState();
33+
}
34+
35+
final Stop stop;
36+
StopWebViewState(this.stop);
37+
Widget build(BuildContext context) {
38+
return Scaffold(
39+
appBar: PreferredSize(
40+
preferredSize: Size.fromHeight(0.0),
41+
child: AppBar(backgroundColor: Colors.black),
42+
),
43+
body: _isLoading
44+
? CircularProgressIndicator()
45+
: WebView(
46+
initialUrl: tableThemeInt == 3 ? Theme.of(context).brightness == Brightness.dark ? (stop.url + "0") : (stop.url + "1"): url,
47+
javascriptMode: JavascriptMode.unrestricted,
48+
),
49+
);
50+
}
51+
}

lib/widgets/webview.dart

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
1-
import 'package:flutter/material.dart';
2-
import 'package:webview_flutter/webview_flutter.dart';
3-
import 'package:shared_preferences/shared_preferences.dart';
1+
import 'dart:convert';
42

5-
import 'stopList.dart';
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
5+
import 'package:url_launcher/url_launcher.dart';
66

7-
class StopWebView extends StatefulWidget {
8-
final Stop stop;
9-
StopWebView(this.stop);
7+
class BasicWebView extends StatefulWidget {
8+
final url;
9+
BasicWebView(this.url);
1010
@override
11-
StopWebViewState createState() => StopWebViewState(stop);
11+
BasicWebViewState createState() => BasicWebViewState(url);
1212
}
1313

14-
class StopWebViewState extends State<StopWebView> {
15-
int tableThemeInt;
16-
bool _isLoading = true;
14+
class BasicWebViewState extends State<BasicWebView> {
1715
var url;
18-
19-
_getPrefs() async {
20-
SharedPreferences prefs = await SharedPreferences.getInstance();
21-
setState(() {
22-
tableThemeInt = prefs.getInt('tableThemeInt');
23-
url = stop.url+tableThemeInt.toString();
24-
print(url);
25-
_isLoading = false;
26-
});
27-
}
16+
var actualUrl;
17+
var webviewTitle;
18+
final flutterWebviewPlugin = new FlutterWebviewPlugin();
2819

2920
@override
30-
void initState() {
31-
_getPrefs();
21+
initState() {
22+
flutterWebviewPlugin.onUrlChanged.listen((url) async {
23+
webviewTitle = await flutterWebviewPlugin.evalJavascript('window.document.title');
24+
actualUrl = await flutterWebviewPlugin.evalJavascript('window.document.URL');
25+
webviewTitle = jsonDecode(webviewTitle);
26+
actualUrl = jsonDecode(actualUrl);
27+
setState(() => {});
28+
});
3229
super.initState();
3330
}
34-
final Stop stop;
35-
StopWebViewState(this.stop);
31+
32+
BasicWebViewState(this.url);
3633
Widget build(BuildContext context) {
37-
return Scaffold(
38-
appBar: PreferredSize(
39-
preferredSize: Size.fromHeight(0.0),
40-
child: AppBar(backgroundColor: Colors.black),
34+
return WebviewScaffold(
35+
appBar: AppBar(
36+
title: webviewTitle != null
37+
? Column(
38+
mainAxisAlignment: MainAxisAlignment.start,
39+
crossAxisAlignment: CrossAxisAlignment.start,
40+
children: <Widget>[
41+
Text(
42+
webviewTitle,
43+
style: TextStyle(fontSize: 16.0),
44+
),
45+
Text(
46+
url,
47+
style: TextStyle(fontSize: 8.0),
48+
)
49+
],
50+
)
51+
: Text(
52+
url,
53+
style: TextStyle(fontSize: 10.0),
54+
),
55+
actions: <Widget>[
56+
IconButton(icon: Icon(Icons.exit_to_app), onPressed: (() => launch(actualUrl)))
57+
],
4158
),
42-
body: _isLoading ? CircularProgressIndicator() : WebView(
43-
initialUrl: url, javascriptMode: JavascriptMode.unrestricted,),
59+
url: url,
60+
withJavascript: true,
4461
);
4562
}
4663
}

pubspec.lock

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,18 @@ packages:
170170
url: "https://pub.dartlang.org"
171171
source: hosted
172172
version: "1.7.0"
173+
flutter_web_plugins:
174+
dependency: transitive
175+
description: flutter
176+
source: sdk
177+
version: "0.0.0"
173178
flutter_webview_plugin:
174179
dependency: "direct main"
175180
description:
176181
name: flutter_webview_plugin
177182
url: "https://pub.dartlang.org"
178183
source: hosted
179-
version: "0.3.8"
184+
version: "0.3.11"
180185
front_end:
181186
dependency: transitive
182187
description:
@@ -247,6 +252,13 @@ packages:
247252
url: "https://pub.dartlang.org"
248253
source: hosted
249254
version: "0.17.9"
255+
js:
256+
dependency: transitive
257+
description:
258+
name: js
259+
url: "https://pub.dartlang.org"
260+
source: hosted
261+
version: "0.6.1+1"
250262
kernel:
251263
dependency: transitive
252264
description:
@@ -345,6 +357,13 @@ packages:
345357
url: "https://pub.dartlang.org"
346358
source: hosted
347359
version: "2.4.0"
360+
plugin_platform_interface:
361+
dependency: transitive
362+
description:
363+
name: plugin_platform_interface
364+
url: "https://pub.dartlang.org"
365+
source: hosted
366+
version: "1.0.2"
348367
preferences:
349368
dependency: "direct main"
350369
description:
@@ -441,6 +460,34 @@ packages:
441460
url: "https://pub.dartlang.org"
442461
source: hosted
443462
version: "1.1.6"
463+
url_launcher:
464+
dependency: "direct main"
465+
description:
466+
name: url_launcher
467+
url: "https://pub.dartlang.org"
468+
source: hosted
469+
version: "5.4.5"
470+
url_launcher_macos:
471+
dependency: transitive
472+
description:
473+
name: url_launcher_macos
474+
url: "https://pub.dartlang.org"
475+
source: hosted
476+
version: "0.0.1+5"
477+
url_launcher_platform_interface:
478+
dependency: transitive
479+
description:
480+
name: url_launcher_platform_interface
481+
url: "https://pub.dartlang.org"
482+
source: hosted
483+
version: "1.0.6"
484+
url_launcher_web:
485+
dependency: transitive
486+
description:
487+
name: url_launcher_web
488+
url: "https://pub.dartlang.org"
489+
source: hosted
490+
version: "0.1.1+2"
444491
vector_math:
445492
dependency: transitive
446493
description:
@@ -478,4 +525,4 @@ packages:
478525
version: "2.1.16"
479526
sdks:
480527
dart: ">=2.4.0 <3.0.0"
481-
flutter: ">=1.5.0 <2.0.0"
528+
flutter: ">=1.12.13+hotfix.5 <2.0.0"

0 commit comments

Comments
 (0)