enable bottom actions before first image is reached
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
e88e17a4b0
commit
96d9604fe1
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common/widgets/overlay.dart';
|
||||
import 'package:flutter_hbb/mobile/pages/server_page.dart';
|
||||
import 'package:flutter_hbb/mobile/pages/settings_page.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -26,7 +25,6 @@ class _HomePageState extends State<HomePage> {
|
||||
var _selectedIndex = 0;
|
||||
int get selectedIndex => _selectedIndex;
|
||||
final List<PageShape> _pages = [];
|
||||
final _blockableOverlayState = BlockableOverlayState();
|
||||
|
||||
void refreshPages() {
|
||||
setState(() {
|
||||
@ -38,7 +36,6 @@ class _HomePageState extends State<HomePage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
initPages();
|
||||
_blockableOverlayState.applyFfi(gFFI);
|
||||
}
|
||||
|
||||
void initPages() {
|
||||
|
@ -39,6 +39,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||
String _value = '';
|
||||
Orientation? _currentOrientation;
|
||||
|
||||
final _blockableOverlayState = BlockableOverlayState();
|
||||
|
||||
final keyboardVisibilityController = KeyboardVisibilityController();
|
||||
late final StreamSubscription<bool> keyboardSubscription;
|
||||
final FocusNode _mobileFocusNode = FocusNode();
|
||||
@ -67,6 +69,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||
initSharedStates(widget.id);
|
||||
gFFI.chatModel
|
||||
.changeCurrentKey(MessageKey(widget.id, ChatModel.clientModeID));
|
||||
|
||||
_blockableOverlayState.applyFfi(gFFI);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -88,6 +92,15 @@ class _RemotePageState extends State<RemotePage> {
|
||||
removeSharedStates(widget.id);
|
||||
}
|
||||
|
||||
Widget emptyOverlay() => BlockableOverlay(
|
||||
/// the Overlay key will be set with _blockableOverlayState in BlockableOverlay
|
||||
/// see override build() in [BlockableOverlay]
|
||||
state: _blockableOverlayState,
|
||||
underlying: Container(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
);
|
||||
|
||||
void onSoftKeyboardChanged(bool visible) {
|
||||
if (!visible) {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
|
||||
@ -198,13 +211,19 @@ class _RemotePageState extends State<RemotePage> {
|
||||
});
|
||||
}
|
||||
|
||||
bool get keyboard => gFFI.ffiModel.permissions['keyboard'] != false;
|
||||
|
||||
Widget _bottomWidget() => _showGestureHelp
|
||||
? getGestureHelp()
|
||||
: (_showBar && gFFI.ffiModel.pi.displays.isNotEmpty
|
||||
? getBottomAppBar(keyboard)
|
||||
: Offstage());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pi = Provider.of<FfiModel>(context).pi;
|
||||
final keyboardIsVisible =
|
||||
keyboardVisibilityController.isVisible && _showEdit;
|
||||
final showActionButton = !_showBar || keyboardIsVisible || _showGestureHelp;
|
||||
final keyboard = gFFI.ffiModel.permissions['keyboard'] != false;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
@ -241,11 +260,17 @@ class _RemotePageState extends State<RemotePage> {
|
||||
}
|
||||
});
|
||||
}),
|
||||
bottomNavigationBar: _showGestureHelp
|
||||
? getGestureHelp()
|
||||
: (_showBar && pi.displays.isNotEmpty
|
||||
? getBottomAppBar(keyboard)
|
||||
: null),
|
||||
bottomNavigationBar: Obx(() => Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
gFFI.ffiModel.pi.isSet.isTrue &&
|
||||
gFFI.ffiModel.waitForFirstImage.isTrue
|
||||
? emptyOverlay()
|
||||
: Offstage(),
|
||||
_bottomWidget(),
|
||||
gFFI.ffiModel.pi.isSet.isFalse ? emptyOverlay() : Offstage(),
|
||||
],
|
||||
)),
|
||||
body: Overlay(
|
||||
initialEntries: [
|
||||
OverlayEntry(builder: (context) {
|
||||
@ -368,12 +393,15 @@ class _RemotePageState extends State<RemotePage> {
|
||||
},
|
||||
),
|
||||
]),
|
||||
IconButton(
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.expand_more),
|
||||
onPressed: () {
|
||||
setState(() => _showBar = !_showBar);
|
||||
}),
|
||||
Obx(() => IconButton(
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.expand_more),
|
||||
onPressed: gFFI.ffiModel.waitForFirstImage.isTrue
|
||||
? null
|
||||
: () {
|
||||
setState(() => _showBar = !_showBar);
|
||||
},
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user