-
Notifications
You must be signed in to change notification settings - Fork 10
/
downgrading_page.dart
107 lines (104 loc) · 4.47 KB
/
downgrading_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import 'package:byr_mobile_app/configurations/configurations.dart';
import 'package:byr_mobile_app/customizations/theme_controller.dart';
import 'package:byr_mobile_app/local_objects/local_storage.dart';
import 'package:byr_mobile_app/nforum/nforum_service.dart';
import 'package:byr_mobile_app/reusable_components/byr_app_bar.dart';
import 'package:byr_mobile_app/reusable_components/ota_dialog.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class DowngradingPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return DowngradingPageState();
}
}
class DowngradingPageState extends State<DowngradingPage> {
Map _resultMap;
@override
void initState() {
super.initState();
NForumService.getAndroidVersions().then((resultMap) {
_resultMap = resultMap;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: BYRAppBar(
title: Text(
"downgradeTrans".tr,
),
),
backgroundColor: E().otherPagePrimaryColor,
body: _resultMap == null
? Container()
: SingleChildScrollView(
child: Column(
children: List.generate(_resultMap["versions"].length, (index) {
return Column(
children: [
Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
_resultMap["versions"][index]["version"].toString(),
style: TextStyle(color: E().otherPagePrimaryTextColor),
),
if (!(_resultMap["versions"][index]["version"].toString() == AppConfigs.version))
FlatButton(
child: Icon(
Icons.system_update,
color: E().otherPageButtonColor,
),
onPressed: () {
LocalStorage.setIgnoreVersion(null);
showDialog<void>(
context: context,
builder: (BuildContext context) {
return OTADialog(
_resultMap["versions"][index]["version"].toString(),
_resultMap["versions"][index]["url"].toString(),
updateContent: "- " +
_resultMap["versions"][index]["changelog"]
.toString()
.replaceAll(";", "\n")
.split("\n")
.join("\n- "),
);
});
},
),
],
),
Text(
"- " +
_resultMap["versions"][index]["changelog"]
.toString()
.replaceAll(";", "\n")
.split("\n")
.join("\n- "),
textAlign: TextAlign.left,
style: TextStyle(color: E().otherPagePrimaryTextColor),
),
],
),
),
Container(
color: E().otherPageDividerColor,
height: 1,
),
],
);
}),
),
),
);
}
}