Skip to content

Commit

Permalink
safeArea
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtian616 committed Jul 16, 2022
1 parent 0cdc81c commit 2cd6dde
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 82 deletions.
52 changes: 26 additions & 26 deletions lib/src/pages/base/base_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,28 @@ abstract class BasePageFlutterState extends State<BasePage> {
}

Widget buildList(BuildContext context) {
return GetBuilder<BasePageLogic>(
id: logic.bodyId,
global: false,
init: logic,
builder: (_) => state.gallerys.isEmpty && state.loadingState != LoadingState.idle
? buildCenterStatusIndicator()
: EHWheelSpeedController(
scrollController: state.scrollController,
child: CustomScrollView(
key: PageStorageKey(runtimeType),
controller: state.scrollController,
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
scrollBehavior: ScrollConfiguration.of(context),
slivers: <Widget>[
buildPullDownIndicator(),
buildGalleryCollection(),
buildLoadMoreIndicator(),
],
return SafeArea(
child: GetBuilder<BasePageLogic>(
id: logic.bodyId,
global: false,
init: logic,
builder: (_) => state.gallerys.isEmpty && state.loadingState != LoadingState.idle
? buildCenterStatusIndicator()
: EHWheelSpeedController(
scrollController: state.scrollController,
child: CustomScrollView(
key: PageStorageKey(runtimeType),
controller: state.scrollController,
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
scrollBehavior: ScrollConfiguration.of(context),
slivers: <Widget>[
buildPullDownIndicator(),
buildGalleryCollection(),
buildLoadMoreIndicator(),
],
),
),
),
),
);
}

Expand All @@ -90,13 +92,11 @@ abstract class BasePageFlutterState extends State<BasePage> {
id: logic.loadingStateId,
global: false,
init: logic,
builder: (logic) {
return LoadingStateIndicator(
loadingState: state.loadingState,
errorTapCallback: () => logic.loadMore(),
noDataTapCallback: () => logic.loadMore(),
);
}),
builder: (_) => LoadingStateIndicator(
loadingState: state.loadingState,
errorTapCallback: () => logic.loadMore(),
noDataTapCallback: () => logic.loadMore(),
)),
);
}

Expand Down
14 changes: 7 additions & 7 deletions lib/src/pages/layout/desktop/desktop_layout_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class DesktopLayoutPage extends StatelessWidget {
state.leftColumnFocusScopeNode.requestFocus();
}
},
child: Container(
decoration: state.selectedTabIndex == index
? BoxDecoration(border: Border(left: BorderSide(width: 4, color: Theme.of(context).appBarTheme.foregroundColor!)))
: null,
child: InkWell(
canRequestFocus: false,
child: GestureDetector(
onTap: () => logic.handleTapTabBarButton(index),
behavior: HitTestBehavior.opaque,
child: Container(
height: 36,
width: 48,
decoration: state.selectedTabIndex == index ? BoxDecoration(border: Border(left: BorderSide(width: 4, color: Theme.of(context).appBarTheme.foregroundColor!))) : null,
child: state.selectedTabIndex == index ? state.icons[index].selectedIcon : state.icons[index].unselectedIcon,
onTap: () => logic.handleTapTabBarButton(index),
).paddingAll(8),
),
),
Expand Down
91 changes: 43 additions & 48 deletions lib/src/pages/search/simple/simple_search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,60 +64,57 @@ class _SimpleSearchPageFlutterState extends BasePageFlutterState {
return GetBuilder<SimpleSearchPageLogic>(
id: logic.pageId,
builder: (_) => Scaffold(
body: Column(
children: [
GetBuilder<SimpleSearchPageLogic>(
id: logic.searchFieldId,
builder: (_) => Container(
height: GlobalConfig.searchBarHeight,
margin: const EdgeInsets.only(top: 8, bottom: 8, left: 2, right: 2),
child: Row(
children: [
Expanded(child: _buildSearchField().marginSymmetric(horizontal: 16)),
ExcludeFocus(child: IconButton(icon: const Icon(Icons.attach_file), onPressed: logic.handleFileSearch)),
if (state.gallerys.isNotEmpty && state.bodyType == SearchPageBodyType.gallerys)
ExcludeFocus(
child: FadeIn(
child: IconButton(
icon: const Icon(FontAwesomeIcons.paperPlane, size: 20),
onPressed: logic.handleTapJumpButton,
body: SafeArea(
child: Column(
children: [
GetBuilder<SimpleSearchPageLogic>(
id: logic.searchFieldId,
builder: (_) => Container(
height: GlobalConfig.searchBarHeight,
margin: const EdgeInsets.only(top: 8, bottom: 8, left: 2, right: 2),
child: Row(
children: [
Expanded(child: _buildSearchField().marginSymmetric(horizontal: 16)),
ExcludeFocus(child: IconButton(icon: const Icon(Icons.attach_file), onPressed: logic.handleFileSearch)),
if (state.gallerys.isNotEmpty && state.bodyType == SearchPageBodyType.gallerys)
ExcludeFocus(
child: FadeIn(
child: IconButton(
icon: const Icon(FontAwesomeIcons.paperPlane, size: 20),
onPressed: logic.handleTapJumpButton,
),
),
),
ExcludeFocus(
child: IconButton(
icon: Icon(state.bodyType == SearchPageBodyType.gallerys ? Icons.update_disabled : Icons.history, size: 24),
onPressed: logic.toggleBodyType,
),
),
ExcludeFocus(
child: IconButton(
icon: Icon(state.bodyType == SearchPageBodyType.gallerys ? Icons.update_disabled : Icons.history, size: 24),
onPressed: logic.toggleBodyType,
),
),
ExcludeFocus(
ExcludeFocus(child: IconButton(icon: const Icon(Icons.filter_alt), onPressed: () => logic.handleTapFilterButton(EHSearchConfigDialogType.filter))),
ExcludeFocus(
child: IconButton(
icon: const Icon(Icons.filter_alt), onPressed: () => logic.handleTapFilterButton(EHSearchConfigDialogType.filter))),
ExcludeFocus(
child: IconButton(
icon: const Icon(Icons.add_circle_outline, size: 24),
onPressed: logic.addQuickSearch,
icon: const Icon(Icons.add_circle_outline, size: 24),
onPressed: logic.addQuickSearch,
),
),
),
ExcludeFocus(
child: IconButton(
icon: Icon(
FontAwesomeIcons.bars,
color: Get.theme.appBarTheme.actionsIconTheme?.color,
size: 20,
ExcludeFocus(
child: IconButton(
icon: Icon(
FontAwesomeIcons.bars,
color: Get.theme.appBarTheme.actionsIconTheme?.color,
size: 20,
),
onPressed: () => toNamed(Routes.quickSearch),
),
onPressed: () => toNamed(Routes.quickSearch),
),
),
],
],
),
),
),
),
if (state.bodyType == SearchPageBodyType.suggestionAndHistory)
Expanded(child: _buildSuggestionAndHistoryBody(context))
else if (state.hasSearched)
Expanded(child: buildList(context)),
],
if (state.bodyType == SearchPageBodyType.suggestionAndHistory) Expanded(child: _buildSuggestionAndHistoryBody(context)) else if (state.hasSearched) Expanded(child: buildList(context)),
],
),
),
),
);
Expand Down Expand Up @@ -222,9 +219,7 @@ class _SimpleSearchPageFlutterState extends BasePageFlutterState {
duration: const Duration(milliseconds: 500),
child: ListTile(
title: RichText(text: _highlightKeyword(context, '${tagData.namespace} : ${tagData.key}', false)),
subtitle: tagData.tagName == null
? null
: RichText(text: _highlightKeyword(context, '${tagData.namespace.tr} : ${tagData.tagName}', true)),
subtitle: tagData.tagName == null ? null : RichText(text: _highlightKeyword(context, '${tagData.namespace.tr} : ${tagData.tagName}', true)),
leading: const Icon(Icons.search),
dense: true,
minLeadingWidth: 20,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/setting/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SettingPage extends StatelessWidget {
title: Text('download'.tr),
onTap: () => toNamed(Routes.settingPrefix + 'download'),
),
if (StyleSetting.actualLayoutMode.value == LayoutMode.desktop)
if (StyleSetting.actualLayoutMode.value == LayoutMode.desktop && GetPlatform.isDesktop)
ListTile(
leading: const Icon(Icons.mouse),
title: Text('mouseWheel'.tr),
Expand Down

0 comments on commit 2cd6dde

Please sign in to comment.