@@ -15,17 +15,11 @@ import 'package:LoliSnatcher/pages/SettingsPage.dart';
1515import 'package:LoliSnatcher/SnatchHandler.dart' ;
1616import 'package:LoliSnatcher/pages/SnatcherPage.dart' ;
1717import 'package:LoliSnatcher/getPerms.dart' ;
18- import 'package:LoliSnatcher/libBooru/BooruItem.dart' ;
1918import 'package:LoliSnatcher/widgets/FlashElements.dart' ;
2019import 'package:LoliSnatcher/widgets/TagSearchButton.dart' ;
20+ import 'package:LoliSnatcher/widgets/ResizableSplitView.dart' ;
2121
22- class DesktopHome extends StatefulWidget {
23- @override
24- _DesktopHomeState createState () => _DesktopHomeState ();
25- DesktopHome ();
26- }
27-
28- class _DesktopHomeState extends State <DesktopHome > {
22+ class DesktopHome extends StatelessWidget {
2923 final SnatchHandler snatchHandler = Get .find <SnatchHandler >();
3024 final SettingsHandler settingsHandler = Get .find <SettingsHandler >();
3125 final SearchHandler searchHandler = Get .find <SearchHandler >();
@@ -36,6 +30,7 @@ class _DesktopHomeState extends State<DesktopHome> {
3630 resizeToAvoidBottomInset: false ,
3731 appBar: AppBar (
3832 toolbarHeight: 60 ,
33+ backgroundColor: Get .theme.colorScheme.background,
3934 actions: < Widget > [
4035 Obx (() {
4136 if (settingsHandler.booruList.isNotEmpty && searchHandler.list.isNotEmpty) {
@@ -56,71 +51,57 @@ class _DesktopHomeState extends State<DesktopHome> {
5651 return const SizedBox ();
5752 }
5853 }),
59-
6054 Obx (() {
6155 if (settingsHandler.booruList.isNotEmpty && searchHandler.list.isNotEmpty) {
6256 return SettingsButton (
6357 name: 'Snatcher' ,
64- icon: Icon (Icons .download),
58+ icon: Icon (Icons .download, color : Get .theme.colorScheme.onBackground ),
6559 iconOnly: true ,
6660 page: () => SnatcherPage (),
6761 );
6862 } else {
6963 return const SizedBox ();
7064 }
7165 }),
72-
7366 Obx (() {
7467 if (settingsHandler.booruList.isEmpty || searchHandler.list.isEmpty) {
7568 return Center (child: Text ('Add Boorus in Settings' ));
7669 } else {
7770 return const SizedBox ();
7871 }
7972 }),
80-
8173 SettingsButton (
8274 name: 'Settings' ,
83- icon: Icon (Icons .settings),
75+ icon: Icon (Icons .settings, color : Get .theme.colorScheme.onBackground ),
8476 iconOnly: true ,
8577 page: () => SettingsPage (),
8678 ),
87-
8879 Obx (() {
89- if (searchHandler.list.isNotEmpty) {
80+ if (searchHandler.list.isNotEmpty) {
9081 return Stack (
9182 alignment: Alignment .center,
9283 children: [
9384 SettingsButton (
9485 name: 'Save' ,
95- icon: Icon (Icons .save),
86+ icon: Icon (Icons .save, color : Get .theme.colorScheme.onBackground ),
9687 iconOnly: true ,
9788 action: () {
9889 getPerms ();
9990 // call a function to save the currently viewed image when the save button is pressed
100- if (searchHandler.currentTab.selected.length > 0 ){
91+ if (searchHandler.currentTab.selected.length > 0 ) {
10192 snatchHandler.queue (
102- searchHandler.currentTab.getSelected (),
103- searchHandler.currentTab.selectedBooru.value,
104- settingsHandler.snatchCooldown
105- );
93+ searchHandler.currentTab.getSelected (), searchHandler.currentTab.selectedBooru.value, settingsHandler.snatchCooldown);
10694 searchHandler.currentTab.selected.value = [];
10795 } else {
10896 FlashElements .showSnackbar (
10997 context: context,
110- title: Text (
111- "No items selected" ,
112- style: TextStyle (fontSize: 20 )
113- ),
114- overrideLeadingIconWidget: Text (
115- " (」°ロ°)」 " ,
116- style: TextStyle (fontSize: 18 )
117- ),
98+ title: Text ("No items selected" , style: TextStyle (fontSize: 20 )),
99+ overrideLeadingIconWidget: Text (" (」°ロ°)」 " , style: TextStyle (fontSize: 18 )),
118100 );
119101 }
120102 },
121103 ),
122-
123- if (searchHandler.currentTab.selected.isNotEmpty)
104+ if (searchHandler.currentTab.selected.isNotEmpty)
124105 Positioned (
125106 child: Container (
126107 width: 20 ,
@@ -132,87 +113,66 @@ class _DesktopHomeState extends State<DesktopHome> {
132113 ),
133114 child: Center (
134115 child: FittedBox (
135- child: Text (
136- '${searchHandler .currentTab .selected .length }' ,
137- style: TextStyle (color: Get .theme.colorScheme.onSecondary)
138- ),
139- )
140- )
116+ child: Text ('${searchHandler .currentTab .selected .length }' , style: TextStyle (color: Get .theme.colorScheme.onSecondary)),
117+ ),
118+ ),
141119 ),
142120 right: 2 ,
143121 bottom: 5 ,
144- )
145- ]
122+ ),
123+ ],
146124 );
147125 } else {
148126 return const SizedBox ();
149127 }
150128 }),
151-
152129 ],
153130 ),
154131 body: Center (
155- child: Row (
156- children: [
157- Expanded (
158- flex: 1 ,
159- child: Column (
160- children: [
161- Expanded (
162- child: Center (child: ImagePreviews ()),
163- flex: 2 ,
164- ),
165- Expanded (
166- flex: 1 ,
167- child: DesktopTagListener (),
168- ),
169- ],
170- ),
171- ),
172- Expanded (
173- flex: 2 ,
174- child: Obx (() => searchHandler.list.isEmpty ? const SizedBox () : DesktopImageListener (searchHandler.currentTab)),
175- ),
176- ]
177- )
132+ child: ResizableSplitView (
133+ firstChild: ResizableSplitView (
134+ firstChild: ImagePreviews (),
135+ secondChild: DesktopTagListener (),
136+ startRatio: 0.66 ,
137+ minRatio: 0.33 ,
138+ maxRatio: 1 ,
139+ direction: SplitDirection .vertical,
140+ onRatioChange: (double newRatio) {
141+ // print('ratioChanged1 $newRatio');
142+ // TODO save to settings, but debounce the saving to file
143+ },
144+ ),
145+ secondChild: Obx (() => searchHandler.list.isEmpty ? const SizedBox () : DesktopImageListener (searchHandler.currentTab)),
146+ startRatio: 0.33 ,
147+ minRatio: 0.2 ,
148+ maxRatio: 0.8 ,
149+ onRatioChange: (double newRatio) {
150+ // print('ratioChanged2 $newRatio');
151+ // TODO save to settings, but debounce the saving to file
152+ },
153+ ),
178154 ),
179155 );
180156 }
181157}
182158
183-
184- class DesktopTagListener extends StatefulWidget {
185- DesktopTagListener ();
186- @override
187- _DesktopTagListenerState createState () => _DesktopTagListenerState ();
188- }
189-
190- class _DesktopTagListenerState extends State <DesktopTagListener > {
191- SearchHandler searchHandler = Get .find <SearchHandler >();
159+ class DesktopTagListener extends StatelessWidget {
160+ final SearchHandler searchHandler = Get .find <SearchHandler >();
192161
193162 @override
194163 Widget build (BuildContext context) {
195164 return Obx (() {
196- if (searchHandler.list.isEmpty) {
197- return Center (
198- child: CircularProgressIndicator (
199- valueColor: AlwaysStoppedAnimation (Get .theme.colorScheme.secondary)
200- )
201- );
165+ if (searchHandler.list.isEmpty) {
166+ return Center (child: CircularProgressIndicator (valueColor: AlwaysStoppedAnimation (Get .theme.colorScheme.secondary)));
202167 }
203168
204- BooruItem item = searchHandler.currentTab.currentItem.value;
205-
206169 return Container (
207- child: TagView (item ),
208- padding: EdgeInsets .all (5 ),
170+ child: TagView (),
171+ padding: EdgeInsets .all (2 ),
209172 decoration: BoxDecoration (
210- border: Border .all (color: Get .theme.colorScheme.secondary,width: 2 ),
173+ border: Border .all (color: Get .theme.colorScheme.secondary, width: 1 ),
211174 ),
212175 );
213176 });
214177 }
215178}
216-
217-
218-
0 commit comments