fix: mobile toolbar UI shift (#818)
This commit is contained in:
parent
3cd2aae003
commit
d73e8893d1
3 changed files with 21 additions and 2 deletions
|
|
@ -97,7 +97,10 @@ class _HomePageState extends State<HomePage> {
|
||||||
surfaceTintColor: Colors.transparent,
|
surfaceTintColor: Colors.transparent,
|
||||||
title: const Text('AppFlowy Editor'),
|
title: const Text('AppFlowy Editor'),
|
||||||
),
|
),
|
||||||
body: SafeArea(child: _widgetBuilder(context)),
|
body: SafeArea(
|
||||||
|
maintainBottomViewPadding: true,
|
||||||
|
child: _widgetBuilder(context),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,20 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:example/home_page.dart';
|
import 'package:example/home_page.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge, overlays: []);
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/editor/toolbar/mobile/utils/keyboard_height_observer.dart';
|
import 'package:appflowy_editor/src/editor/toolbar/mobile/utils/keyboard_height_observer.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
const String selectionExtraInfoDisableMobileToolbarKey = 'disableMobileToolbar';
|
const String selectionExtraInfoDisableMobileToolbarKey = 'disableMobileToolbar';
|
||||||
|
|
@ -384,8 +385,12 @@ class _MobileToolbarState extends State<_MobileToolbar>
|
||||||
return ValueListenableBuilder(
|
return ValueListenableBuilder(
|
||||||
valueListenable: showMenuNotifier,
|
valueListenable: showMenuNotifier,
|
||||||
builder: (_, showingMenu, __) {
|
builder: (_, showingMenu, __) {
|
||||||
|
var toolbarHeight = height;
|
||||||
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||||
|
toolbarHeight += MediaQuery.of(context).viewPadding.bottom;
|
||||||
|
}
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: height,
|
height: toolbarHeight,
|
||||||
child: (showingMenu && selectedMenuIndex != null)
|
child: (showingMenu && selectedMenuIndex != null)
|
||||||
? MobileToolbarItemMenu(
|
? MobileToolbarItemMenu(
|
||||||
editorState: widget.editorState,
|
editorState: widget.editorState,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue