Alot of changes
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:bus_infotainment/backend/live_information.dart';
|
||||
import 'package:bus_infotainment/pages/settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class InitialStartup extends StatefulWidget {
|
||||
|
||||
@@ -9,11 +14,43 @@ class InitialStartup extends StatefulWidget {
|
||||
State<InitialStartup> createState() => _InitialStartupState();
|
||||
}
|
||||
|
||||
const String Version = "0.2.0";
|
||||
// Get the current version from /assets/version.txt
|
||||
Future<String> GetVersion() async {
|
||||
return await rootBundle.loadString("assets/version.txt");
|
||||
}
|
||||
|
||||
class _InitialStartupState extends State<InitialStartup> {
|
||||
bool AllowPassage = false;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
SharedPreferences.getInstance().then((prefs) {
|
||||
String? base64String = prefs.getString("announcements");
|
||||
|
||||
if (base64String != null) {
|
||||
print("Found previois announcement file");
|
||||
Uint8List ByteList = base64Decode(base64String);
|
||||
|
||||
LiveInformation().announcementModule.setBundleBytes(ByteList);
|
||||
|
||||
Navigator.pushNamed(context, "/application");
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
print("No previous announcement file found");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
@@ -28,6 +65,8 @@ class _InitialStartupState extends State<InitialStartup> {
|
||||
|
||||
children: [
|
||||
|
||||
PermissionsSetup(),
|
||||
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
@@ -79,13 +118,29 @@ class _InitialStartupState extends State<InitialStartup> {
|
||||
height: 8,
|
||||
),
|
||||
|
||||
Text(
|
||||
"Version $Version",
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.grey
|
||||
),
|
||||
FutureBuilder(
|
||||
future: GetVersion(),
|
||||
builder: (context, snapshot){
|
||||
if (snapshot.hasData){
|
||||
return Text(
|
||||
"Version ${snapshot.data}",
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.grey
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Text(
|
||||
"Version -.-.-",
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.grey
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user