Move the update stuff to its own page
This commit is contained in:
parent
fcf5348f96
commit
4504708df8
6 changed files with 106 additions and 41 deletions
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:libacflutter/Constants.dart';
|
||||
import 'package:ota_update/ota_update.dart';
|
||||
import 'package:timetrack/consts.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
|
@ -37,47 +36,20 @@ class _HomePageState extends State<HomePage> {
|
|||
Text("Time Tracker"),
|
||||
Text("Created by Tara Piccari"),
|
||||
Text("Copyright 2025 - Present"),
|
||||
],
|
||||
),
|
||||
),
|
||||
DrawerHeader(
|
||||
child: Column(
|
||||
children: [
|
||||
Text("Version: ${TTConsts.VERSION}"),
|
||||
Text("Update Channel: ${TTConsts.UPDATE_CHANNEL}"),
|
||||
Text(
|
||||
"* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
DrawerHeader(
|
||||
child: Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await TTConsts.checkUpdate();
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
child: Text("Check for Update"),
|
||||
),
|
||||
if (TTConsts.UPDATE_AVAILABLE)
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
OtaUpdate()
|
||||
.execute(
|
||||
"https://ci.zontreck.com/job/Projects/job/Dart/job/Time%20Tracker/job/main/lastSuccessfulBuild/artifact/build/app/outputs/flutter-apk/timetrack.apk",
|
||||
destinationFilename: "timetrack.apk",
|
||||
)
|
||||
.listen((OtaEvent event) {
|
||||
//setState(() => currentEvent = event);
|
||||
});
|
||||
},
|
||||
child: Text("Install Update"),
|
||||
),
|
||||
],
|
||||
ListTile(
|
||||
title: Text("Update Settings.."),
|
||||
subtitle: Text(
|
||||
"Open the update settings. Channel, check for updates, and installation",
|
||||
),
|
||||
onTap: () async {
|
||||
await Navigator.pushNamed(context, "/upd");
|
||||
setState(() {});
|
||||
},
|
||||
leading: Icon(Icons.update),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue