Skip to content

Commit

Permalink
Fix some if state
Browse files Browse the repository at this point in the history
  • Loading branch information
TaYaKi71751 committed Dec 23, 2023
1 parent 648b972 commit 99297e9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
12 changes: 9 additions & 3 deletions lib/pages/article_info/article_info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ class MultiChipWidget extends StatelessWidget {
child: Wrap(
spacing: 3.0,
runSpacing: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 9.0;
if(Platform.isAndroid || Platform.isIOS) return -9.0;
if(Platform.isLinux) return 9.0;
return -9.0;
})(),
children: groupName
Expand Down Expand Up @@ -551,7 +553,9 @@ class PreviewAreaWidget extends StatelessWidget {
shrinkWrap: true,
crossAxisCount: ((){
// @default return 3;
if(Settings.useTabletMode){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
){
return int.parse('${(int.parse(('${(MediaQuery.of(context).size.width)}'.split('.')[0])) / 200)}'.split('.')[0]);
} else {
return 3;
Expand Down Expand Up @@ -1156,8 +1160,10 @@ class _Chip extends StatelessWidget {

return SizedBox(
height: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 44.0;
if(Platform.isAndroid || Platform.isIOS) return 44.0;
if(Platform.isLinux) return 44.0;
return 44.0;
})(),
child: FittedBox(child: fc),
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/search/search_bar_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ class _SearchBarPageState extends State<SearchBarPage>
Wrap(
spacing: 4.0,
runSpacing: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 10.0;
if(Platform.isAndroid || Platform.isIOS) return -10.0;
if(Platform.isLinux) return 10.0;
return -10.0;
})(),
children: _searchLists.map((item) => chip(item)).toList(),
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/settings/tag_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ class _TagSelectorDialogState extends State<TagSelectorDialog> {
child: Wrap(
spacing: 4.0,
runSpacing: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 10.0;
if(Platform.isAndroid || Platform.isIOS) return -10.0;
if(Platform.isLinux) return 10.0;
return -10.0;
})(),
children: _searchLists
Expand Down
30 changes: 20 additions & 10 deletions lib/widgets/article_item/article_list_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,10 @@ class BodyWidget extends StatelessWidget {
],
)
);
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return ClipRect(child: _body);
if(Platform.isAndroid || Platform.isIOS) return _body;
if(Platform.isLinux) return ClipRect(child: _body);
return _body;
})()
: ThumbnailWidget(
Expand Down Expand Up @@ -528,7 +530,7 @@ class _DetailWidget extends StatelessWidget {
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
if (c.articleListItem.showUltra) tagArea() else const Spacer(),
if (c.articleListItem.showUltra) tagArea(context) else const Spacer(),
Row(
children: [
const Icon(Icons.date_range, size: 18),
Expand Down Expand Up @@ -575,7 +577,7 @@ class _DetailWidget extends StatelessWidget {
);
}

Widget tagArea() {
Widget tagArea(context) {
if (c.articleListItem.queryResult.tags() == null) {
return Container(height: 30);
}
Expand All @@ -590,28 +592,34 @@ class _DetailWidget extends StatelessWidget {
var _body = Wrap(
spacing: 3.0,
runSpacing: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 10.0;
if(Platform.isAndroid || Platform.isIOS) return -10.0;
if(Platform.isLinux) return 10.0;
return -10.0;
})(),
children:
tags.map((x) => TagChip(group: x.item1, name: x.item2)).toList(),
);
if(Platform.isAndroid || Platform.isIOS){
return _body;
}
if(Platform.isLinux){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
){
return Container(
height: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 30.0;
if(Platform.isAndroid || Platform.isIOS) return null;
if(Platform.isLinux) return 30.0;
return null;
})(),
child: ClipRect(
child: _body,
)
);
}
if(Platform.isAndroid || Platform.isIOS){
return _body;
}
return _body;
}
}
Expand Down Expand Up @@ -733,8 +741,10 @@ class TagChip extends StatelessWidget {

return SizedBox(
height: ((){
if(Platform.isLinux || Settings.useTabletMode ||
MediaQuery.of(context).orientation == Orientation.landscape
) return 25.0;
if(Platform.isAndroid || Platform.isIOS) return 42.0;
if(Platform.isLinux) return 25.0;
return 42.0;
})(),
child: FittedBox(child: fc),
Expand Down

0 comments on commit 99297e9

Please sign in to comment.