@@ -44,69 +44,108 @@ class _FlashPartitionsState extends State<FlashPartitions> {
4444 Widget build (BuildContext context) {
4545 return Scaffold (
4646 appBar: AppBar (
47- title: const Text ('Flash Partitions' ),
47+ title: Row (
48+ children: [
49+ const Text ("Flash partitions" ),
50+ Text (" | ${backupFolder ?.path ?? "No folder selected" } | " , style: const TextStyle (fontSize: 18 ),),
51+ Text ("Device: $device " , style: const TextStyle (fontSize: 18 ),),
52+
53+ ],
54+ )
4855 ),
4956 body: Column (
5057 children: [
51- Padding (
52- padding: const EdgeInsets .all (16.0 ),
53- child: Row (
54- mainAxisAlignment: MainAxisAlignment .spaceBetween,
55- crossAxisAlignment: CrossAxisAlignment .start,
56- children: [
57- Column (
58- crossAxisAlignment: CrossAxisAlignment .start,
59- children: [
60- Text ('Device: $device ' ),
61- const SizedBox (height: 4 ),
62- Text (
63- 'Backup Folder: ${backupFolder ?.path ?? "Not selected" }' ),
64- ],
65- ),
66- Row (
67- children: [
68- ElevatedButton (
69- onPressed: () {
70- Process .run ('fastboot' , ['devices' ]).then ((result) {
71- setState (() {
72- device = result.stdout.toString ();
73- });
74- });
75- },
76- child: const Text ('Refresh' ),
77- ),
78- const SizedBox (width: 16 ),
79- ElevatedButton (
80- onPressed: () {
81- outputController.text = "" ;
82- },
83- child: const Text ('Clear Output' ),
84- ),
85- const SizedBox (width: 16 ),
86- ElevatedButton (
87- onPressed: () async {
88- String ? directoryPath =
89- await FilePicker .platform.getDirectoryPath ();
90- if (directoryPath != null ) {
91- setState (() {
92- backupFolder = Directory (directoryPath);
93- });
94- retrievePartitionNames ();
95- }
96- },
97- child: const Text ('Select Backup Folder' ),
98- ),
99- const SizedBox (width: 8 ),
100- if (backupFolder != null )
101- ElevatedButton (
102- onPressed: flashAllPartitions,
103- child: const Text ("Flash All" ),
104- )
105- ],
106- ),
107- ],
108- ),
58+ const SizedBox (height: 8 ,),
59+ Row (
60+ mainAxisAlignment: MainAxisAlignment .center,
61+ children: [
62+ FilledButton (
63+ onPressed: () {
64+ Process .run ('fastboot' , ['-w' ]).then ((result) {
65+ setState (() {
66+ device = result.stdout.toString ();
67+ });
68+ });
69+ },
70+ child: const Text ('Wipe userdata' ),
71+ ),
72+ const SizedBox (width: 16 ),
73+ FilledButton (
74+ onPressed: () {
75+ Process .run ('fastboot' , ['flashing' , 'lock' ])
76+ .then ((result) {
77+ setState (() {
78+ device = result.stdout.toString ();
79+ });
80+ });
81+ },
82+ child: const Text ('Lock Bootloader' ),
83+ ),
84+ const SizedBox (width: 16 ),
85+ FilledButton (
86+ onPressed: () {
87+ Process .run ('fastboot' , ['flashing' , 'unlock' ])
88+ .then ((result) {
89+ setState (() {
90+ device = result.stdout.toString ();
91+ });
92+ });
93+ },
94+ child: const Text ('Unlock Bootloader' ),
95+ ),
96+ const SizedBox (width: 16 ),
97+ FilledButton (
98+ onPressed: () {
99+ Process .run ('fastboot' , ['reboot' , 'fastboot' ])
100+ .then ((result) {
101+ setState (() {
102+ device = result.stdout.toString ();
103+ });
104+ });
105+ },
106+ child: const Text ('Reboot to fastbootd' ),
107+ ),
108+ const SizedBox (width: 16 ),
109+ ElevatedButton (
110+ onPressed: () {
111+ Process .run ('fastboot' , ['devices' ]).then ((result) {
112+ setState (() {
113+ device = result.stdout.toString ();
114+ });
115+ });
116+ },
117+ child: const Text ('Refresh' ),
118+ ),
119+ const SizedBox (width: 16 ),
120+ ElevatedButton (
121+ onPressed: () {
122+ outputController.text = "" ;
123+ },
124+ child: const Text ('Clear Output' ),
125+ ),
126+ const SizedBox (width: 16 ),
127+ ElevatedButton (
128+ onPressed: () async {
129+ String ? directoryPath =
130+ await FilePicker .platform.getDirectoryPath ();
131+ if (directoryPath != null ) {
132+ setState (() {
133+ backupFolder = Directory (directoryPath);
134+ });
135+ retrievePartitionNames ();
136+ }
137+ },
138+ child: const Text ('Select Backup Folder' ),
139+ ),
140+ const SizedBox (width: 8 ),
141+ if (backupFolder != null )
142+ ElevatedButton (
143+ onPressed: flashAllPartitions,
144+ child: const Text ("Flash All" ),
145+ )
146+ ],
109147 ),
148+ const SizedBox (height: 8 ,),
110149 Expanded (
111150 child: Row (
112151 children: [
@@ -119,7 +158,7 @@ class _FlashPartitionsState extends State<FlashPartitions> {
119158 title: Text (partitionNames[index]),
120159 subtitle: Text (
121160 'Flashing to ${partitionNames [index ].split ('\\ ' ).last } partition' ),
122- trailing: ElevatedButton (
161+ trailing: FilledButton (
123162 onPressed: () {
124163 outputController.text +=
125164 "Flashing ${partitionNames [index ]}\n " ;
@@ -143,19 +182,25 @@ class _FlashPartitionsState extends State<FlashPartitions> {
143182 ),
144183 const SizedBox (width: 16 ),
145184 Expanded (
146- child: Padding (
147- padding: const EdgeInsets .all (8.0 ),
148- child: TextField (
149- controller: outputController,
150- readOnly: true ,
151- maxLines: 100 ,
152- decoration: const InputDecoration (
153- labelText: 'Output' ,
154- border: OutlineInputBorder (),
155- ),
185+ child: Column (
186+ crossAxisAlignment: CrossAxisAlignment .start,
187+ children: [
188+ const Text (
189+ "Output" ,
190+ style: TextStyle (fontSize: 24 ),
156191 ),
157- ),
158- ),
192+ Expanded (
193+ child: TextField (
194+ controller: outputController,
195+ readOnly: true ,
196+ maxLines: 100 ,
197+ decoration: const InputDecoration (
198+ border: InputBorder .none,
199+ ),
200+ ),
201+ )
202+ ],
203+ )),
159204 ],
160205 ),
161206 ),
0 commit comments