feat: hide tabbar when pushing to view page (#4050)

This commit is contained in:
Lucas.Xu 2023-11-30 16:56:59 +08:00 committed by GitHub
parent d7a67c0efb
commit c0ae803280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 92 additions and 89 deletions

View File

@ -43,18 +43,15 @@ class _ViewPageBottomSheetState extends State<ViewPageBottomSheet> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// header
_buildHeader(),
const VSpace(16),
// body
_buildBody(),
],
),
return Column(
mainAxisSize: MainAxisSize.min,
children: [
// header
_buildHeader(),
const VSpace(16),
// body
_buildBody(),
],
);
}

View File

@ -13,6 +13,8 @@ Future<void> showMobileBottomSheet({
required WidgetBuilder builder,
bool isDragEnabled = true,
ShapeBorder? shape,
bool resizeToAvoidBottomInset = true,
EdgeInsets padding = const EdgeInsets.fromLTRB(16, 16, 16, 32),
}) async {
showModalBottomSheet(
context: context,
@ -26,7 +28,20 @@ Future<void> showMobileBottomSheet({
top: Corners.s12Radius,
),
),
builder: builder,
builder: (context) {
final child = builder(context);
if (resizeToAvoidBottomInset) {
return AnimatedPadding(
padding: padding +
EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
duration: Duration.zero,
child: child,
);
}
return child;
},
);
}
@ -62,18 +77,15 @@ class _MobileViewItemBottomSheetState extends State<MobileViewItemBottomSheet> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// header
_buildHeader(),
const VSpace(16),
// body
_buildBody(),
],
),
return Column(
mainAxisSize: MainAxisSize.min,
children: [
// header
_buildHeader(),
const VSpace(16),
// body
_buildBody(),
],
);
}

View File

@ -46,63 +46,55 @@ class _EditUsernameBottomSheetState extends State<EditUsernameBottomSheet> {
}
}
return Padding(
padding: EdgeInsets.only(
top: 16,
right: 16,
left: 16,
bottom: MediaQuery.of(context).viewInsets.bottom + 32,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
LocaleKeys.settings_mobile_username.tr(),
style: theme.textTheme.labelSmall,
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
LocaleKeys.settings_mobile_username.tr(),
style: theme.textTheme.labelSmall,
),
IconButton(
icon: Icon(
Icons.close,
color: theme.hintColor,
),
IconButton(
icon: Icon(
Icons.close,
color: theme.hintColor,
),
onPressed: () {
widget.context.pop();
},
),
],
),
const SizedBox(
height: 16,
),
Form(
key: _formKey,
child: TextFormField(
controller: _textFieldController,
keyboardType: TextInputType.text,
validator: (value) {
if (value == null || value.isEmpty) {
return LocaleKeys.settings_mobile_usernameEmptyError.tr();
}
return null;
onPressed: () {
widget.context.pop();
},
onEditingComplete: submitUserName,
),
],
),
const SizedBox(
height: 16,
),
Form(
key: _formKey,
child: TextFormField(
controller: _textFieldController,
keyboardType: TextInputType.text,
validator: (value) {
if (value == null || value.isEmpty) {
return LocaleKeys.settings_mobile_usernameEmptyError.tr();
}
return null;
},
onEditingComplete: submitUserName,
),
const SizedBox(
height: 16,
),
const SizedBox(
height: 16,
),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: submitUserName,
child: Text(LocaleKeys.button_update.tr()),
),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: submitUserName,
child: Text(LocaleKeys.button_update.tr()),
),
),
],
),
),
],
);
}
}

View File

@ -1,5 +1,6 @@
import 'package:appflowy/env/cloud_env.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/application/user/prelude.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
@ -43,10 +44,8 @@ class PersonalInfoSettingGroup extends StatelessWidget {
: null,
trailing: const Icon(Icons.chevron_right),
onTap: () {
showModalBottomSheet<void>(
showMobileBottomSheet(
context: context,
// avoid bottom sheet overflow from resizing when keyboard appears
isScrollControlled: true,
builder: (_) {
return EditUsernameBottomSheet(
context,

View File

@ -121,15 +121,12 @@ class FlowyBottomSheetPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_SheetTopBar(title: title, isRoot: isRoot),
child,
],
),
return Column(
mainAxisSize: MainAxisSize.min,
children: [
_SheetTopBar(title: title, isRoot: isRoot),
child,
],
);
}
}

View File

@ -107,6 +107,7 @@ class _DateCellState extends GridCellState<GridDateCell> {
onTap: () {
showMobileBottomSheet(
context: context,
padding: EdgeInsets.zero,
builder: (context) {
return MobileDateCellEditScreen(
controller: widget.cellControllerBuilder.build()

View File

@ -208,6 +208,7 @@ class _SelectOptionWrapState extends State<SelectOptionWrap> {
onTap: () {
showMobileBottomSheet(
context: context,
padding: EdgeInsets.zero,
builder: (context) {
return MobileSelectOptionEditor(
cellController: cellController,

View File

@ -431,6 +431,7 @@ GoRoute _signInScreenRoute() {
GoRoute _mobileEditorScreenRoute() {
return GoRoute(
path: MobileEditorScreen.routeName,
parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileEditorScreen.viewId]!;
final title = state.uri.queryParameters[MobileEditorScreen.viewTitle];
@ -447,6 +448,7 @@ GoRoute _mobileEditorScreenRoute() {
GoRoute _mobileGridScreenRoute() {
return GoRoute(
path: MobileGridScreen.routeName,
parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileGridScreen.viewId]!;
final title = state.uri.queryParameters[MobileGridScreen.viewTitle];
@ -463,6 +465,7 @@ GoRoute _mobileGridScreenRoute() {
GoRoute _mobileBoardScreenRoute() {
return GoRoute(
path: MobileBoardScreen.routeName,
parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileBoardScreen.viewId]!;
final title = state.uri.queryParameters[MobileBoardScreen.viewTitle];
@ -479,6 +482,7 @@ GoRoute _mobileBoardScreenRoute() {
GoRoute _mobileCalendarScreenRoute() {
return GoRoute(
path: MobileCalendarScreen.routeName,
parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileCalendarScreen.viewId]!;
final title = state.uri.queryParameters[MobileCalendarScreen.viewTitle]!;