mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-22 22:20:43 -04:00
fix safeareas
This commit is contained in:
parent
0d888363ff
commit
3c95c9d1a3
9 changed files with 51 additions and 194 deletions
|
@ -54,8 +54,6 @@ PODS:
|
||||||
- nanopb/encode (= 3.30910.0)
|
- nanopb/encode (= 3.30910.0)
|
||||||
- nanopb/decode (3.30910.0)
|
- nanopb/decode (3.30910.0)
|
||||||
- nanopb/encode (3.30910.0)
|
- nanopb/encode (3.30910.0)
|
||||||
- native_device_orientation (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- package_info_plus (0.4.5):
|
- package_info_plus (0.4.5):
|
||||||
- Flutter
|
- Flutter
|
||||||
- pasteboard (0.0.1):
|
- pasteboard (0.0.1):
|
||||||
|
@ -87,7 +85,6 @@ DEPENDENCIES:
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||||
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
|
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
|
||||||
- native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`)
|
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
|
@ -124,8 +121,6 @@ EXTERNAL SOURCES:
|
||||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||||
mobile_scanner:
|
mobile_scanner:
|
||||||
:path: ".symlinks/plugins/mobile_scanner/ios"
|
:path: ".symlinks/plugins/mobile_scanner/ios"
|
||||||
native_device_orientation:
|
|
||||||
:path: ".symlinks/plugins/native_device_orientation/ios"
|
|
||||||
package_info_plus:
|
package_info_plus:
|
||||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||||
pasteboard:
|
pasteboard:
|
||||||
|
@ -163,7 +158,6 @@ SPEC CHECKSUMS:
|
||||||
MLKitVision: 45e79d68845a2de77e2dd4d7f07947f0ed157b0e
|
MLKitVision: 45e79d68845a2de77e2dd4d7f07947f0ed157b0e
|
||||||
mobile_scanner: af8f71879eaba2bbcb4d86c6a462c3c0e7f23036
|
mobile_scanner: af8f71879eaba2bbcb4d86c6a462c3c0e7f23036
|
||||||
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
|
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
|
||||||
native_device_orientation: e3580675687d5034770da198f6839ebf2122ef94
|
|
||||||
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
||||||
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
pasteboard: 49088aeb6119d51f976a421db60d8e1ab079b63c
|
||||||
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
|
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
|
||||||
|
|
|
@ -8,7 +8,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:flutter_translate/flutter_translate.dart';
|
import 'package:flutter_translate/flutter_translate.dart';
|
||||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||||
import 'package:native_device_orientation/native_device_orientation.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:veilid_support/veilid_support.dart';
|
import 'package:veilid_support/veilid_support.dart';
|
||||||
|
|
||||||
|
@ -202,13 +201,7 @@ class VeilidChatApp extends StatelessWidget {
|
||||||
// Once init is done, we proceed with the app
|
// Once init is done, we proceed with the app
|
||||||
final localizationDelegate = LocalizedApp.of(context).delegate;
|
final localizationDelegate = LocalizedApp.of(context).delegate;
|
||||||
|
|
||||||
if (isiOS || isAndroid) {
|
return SafeArea(child: appBuilder(context, localizationDelegate));
|
||||||
return NativeDeviceOrientationReader(
|
|
||||||
//useSensor: false,
|
|
||||||
builder: (context) => appBuilder(context, localizationDelegate));
|
|
||||||
} else {
|
|
||||||
return appBuilder(context, localizationDelegate);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_translate/flutter_translate.dart';
|
import 'package:flutter_translate/flutter_translate.dart';
|
||||||
|
|
||||||
import '../../theme/models/scale_theme/scale_scheme.dart';
|
import '../../theme/models/scale_theme/scale_scheme.dart';
|
||||||
|
import '../../theme/views/views.dart';
|
||||||
|
|
||||||
class NoConversationWidget extends StatelessWidget {
|
class NoConversationWidget extends StatelessWidget {
|
||||||
const NoConversationWidget({super.key});
|
const NoConversationWidget({super.key});
|
||||||
|
@ -37,7 +38,6 @@ class NoConversationWidget extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,10 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Widget buildUserPanel() => Builder(builder: (context) {
|
Widget buildLeftPane(BuildContext context) => Builder(
|
||||||
|
builder: (context) => Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Builder(builder: (context) {
|
||||||
final profile = context.select<AccountRecordCubit, proto.Profile>(
|
final profile = context.select<AccountRecordCubit, proto.Profile>(
|
||||||
(c) => c.state.asData!.value.profile);
|
(c) => c.state.asData!.value.profile);
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
@ -115,11 +118,7 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
|
||||||
]).paddingAll(8),
|
]).paddingAll(8),
|
||||||
const ChatListWidget().expanded()
|
const ChatListWidget().expanded()
|
||||||
]));
|
]));
|
||||||
});
|
})));
|
||||||
|
|
||||||
Widget buildLeftPane(BuildContext context) => Builder(
|
|
||||||
builder: (context) =>
|
|
||||||
Material(color: Colors.transparent, child: buildUserPanel()));
|
|
||||||
|
|
||||||
Widget buildRightPane(BuildContext context) {
|
Widget buildRightPane(BuildContext context) {
|
||||||
final activeChatCubit = context.watch<ActiveChatCubit>();
|
final activeChatCubit = context.watch<ActiveChatCubit>();
|
||||||
|
|
|
@ -13,7 +13,6 @@ import 'package:veilid_support/veilid_support.dart';
|
||||||
import '../../account_manager/account_manager.dart';
|
import '../../account_manager/account_manager.dart';
|
||||||
import '../../settings/settings.dart';
|
import '../../settings/settings.dart';
|
||||||
import '../../theme/theme.dart';
|
import '../../theme/theme.dart';
|
||||||
import '../../tools/native_safe_area.dart';
|
|
||||||
import 'drawer_menu/drawer_menu.dart';
|
import 'drawer_menu/drawer_menu.dart';
|
||||||
import 'home_account_invalid.dart';
|
import 'home_account_invalid.dart';
|
||||||
import 'home_account_locked.dart';
|
import 'home_account_locked.dart';
|
||||||
|
@ -209,7 +208,7 @@ class HomeScreenState extends State<HomeScreen>
|
||||||
.indexWhere((x) => x.superIdentity.recordKey == activeLocalAccount);
|
.indexWhere((x) => x.superIdentity.recordKey == activeLocalAccount);
|
||||||
final canClose = activeIndex != -1;
|
final canClose = activeIndex != -1;
|
||||||
|
|
||||||
Widget homeWidget = DefaultTextStyle(
|
return DefaultTextStyle(
|
||||||
style: theme.textTheme.bodySmall!,
|
style: theme.textTheme.bodySmall!,
|
||||||
child: ZoomDrawer(
|
child: ZoomDrawer(
|
||||||
controller: _zoomDrawerController,
|
controller: _zoomDrawerController,
|
||||||
|
@ -238,13 +237,6 @@ class HomeScreenState extends State<HomeScreen>
|
||||||
mainScreenScale: .25,
|
mainScreenScale: .25,
|
||||||
slideWidth: min(360, MediaQuery.of(context).size.width * 0.9),
|
slideWidth: min(360, MediaQuery.of(context).size.width * 0.9),
|
||||||
));
|
));
|
||||||
|
|
||||||
if (isiOS || isAndroid) {
|
|
||||||
homeWidget = NativeSafeArea(
|
|
||||||
bottom: false, left: false, right: false, child: homeWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
return homeWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:native_device_orientation/native_device_orientation.dart';
|
|
||||||
|
|
||||||
class NativeSafeArea extends StatelessWidget {
|
|
||||||
const NativeSafeArea({
|
|
||||||
required this.child,
|
|
||||||
this.left = true,
|
|
||||||
this.top = true,
|
|
||||||
this.right = true,
|
|
||||||
this.bottom = true,
|
|
||||||
this.minimum = EdgeInsets.zero,
|
|
||||||
this.maintainBottomViewPadding = false,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Whether to avoid system intrusions on the left.
|
|
||||||
final bool left;
|
|
||||||
|
|
||||||
/// Whether to avoid system intrusions at the top of the screen, typically the
|
|
||||||
/// system status bar.
|
|
||||||
final bool top;
|
|
||||||
|
|
||||||
/// Whether to avoid system intrusions on the right.
|
|
||||||
final bool right;
|
|
||||||
|
|
||||||
/// Whether to avoid system intrusions on the bottom side of the screen.
|
|
||||||
final bool bottom;
|
|
||||||
|
|
||||||
/// This minimum padding to apply.
|
|
||||||
///
|
|
||||||
/// The greater of the minimum insets and the media padding will be applied.
|
|
||||||
final EdgeInsets minimum;
|
|
||||||
|
|
||||||
/// Specifies whether the [SafeArea] should maintain the bottom
|
|
||||||
/// [MediaQueryData.viewPadding] instead of the bottom
|
|
||||||
/// [MediaQueryData.padding], defaults to false.
|
|
||||||
///
|
|
||||||
/// For example, if there is an onscreen keyboard displayed above the
|
|
||||||
/// SafeArea, the padding can be maintained below the obstruction rather than
|
|
||||||
/// being consumed. This can be helpful in cases where your layout contains
|
|
||||||
/// flexible widgets, which could visibly move when opening a software
|
|
||||||
/// keyboard due to the change in the padding value. Setting this to true will
|
|
||||||
/// avoid the UI shift.
|
|
||||||
final bool maintainBottomViewPadding;
|
|
||||||
|
|
||||||
/// The widget below this widget in the tree.
|
|
||||||
///
|
|
||||||
/// The padding on the [MediaQuery] for the [child] will be suitably adjusted
|
|
||||||
/// to zero out any sides that were avoided by this widget.
|
|
||||||
///
|
|
||||||
/// {@macro flutter.widgets.ProxyWidget.child}
|
|
||||||
final Widget child;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final nativeOrientation =
|
|
||||||
NativeDeviceOrientationReader.orientation(context);
|
|
||||||
|
|
||||||
late final bool realLeft;
|
|
||||||
late final bool realRight;
|
|
||||||
late final bool realTop;
|
|
||||||
late final bool realBottom;
|
|
||||||
|
|
||||||
switch (nativeOrientation) {
|
|
||||||
case NativeDeviceOrientation.unknown:
|
|
||||||
case NativeDeviceOrientation.portraitUp:
|
|
||||||
realLeft = left;
|
|
||||||
realRight = right;
|
|
||||||
realTop = top;
|
|
||||||
realBottom = bottom;
|
|
||||||
case NativeDeviceOrientation.portraitDown:
|
|
||||||
realLeft = right;
|
|
||||||
realRight = left;
|
|
||||||
realTop = bottom;
|
|
||||||
realBottom = top;
|
|
||||||
case NativeDeviceOrientation.landscapeRight:
|
|
||||||
realLeft = bottom;
|
|
||||||
realRight = top;
|
|
||||||
realTop = left;
|
|
||||||
realBottom = right;
|
|
||||||
case NativeDeviceOrientation.landscapeLeft:
|
|
||||||
realLeft = top;
|
|
||||||
realRight = bottom;
|
|
||||||
realTop = right;
|
|
||||||
realBottom = left;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SafeArea(
|
|
||||||
left: realLeft,
|
|
||||||
right: realRight,
|
|
||||||
top: realTop,
|
|
||||||
bottom: realBottom,
|
|
||||||
minimum: minimum,
|
|
||||||
maintainBottomViewPadding: maintainBottomViewPadding,
|
|
||||||
child: child);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
||||||
super.debugFillProperties(properties);
|
|
||||||
properties
|
|
||||||
..add(DiagnosticsProperty<bool>('left', left))
|
|
||||||
..add(DiagnosticsProperty<bool>('top', top))
|
|
||||||
..add(DiagnosticsProperty<bool>('right', right))
|
|
||||||
..add(DiagnosticsProperty<bool>('bottom', bottom))
|
|
||||||
..add(DiagnosticsProperty<EdgeInsets>('minimum', minimum))
|
|
||||||
..add(DiagnosticsProperty<bool>(
|
|
||||||
'maintainBottomViewPadding', maintainBottomViewPadding));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -260,7 +260,6 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
),
|
),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
child: SafeArea(
|
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Stack(alignment: AlignmentDirectional.center, children: [
|
Stack(alignment: AlignmentDirectional.center, children: [
|
||||||
Image.asset('assets/images/ellet.png'),
|
Image.asset('assets/images/ellet.png'),
|
||||||
|
@ -333,7 +332,7 @@ class _DeveloperPageState extends State<DeveloperPage> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
).paddingAll(4)
|
).paddingAll(4)
|
||||||
]))));
|
])));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -937,14 +937,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.7"
|
version: "6.0.7"
|
||||||
native_device_orientation:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: native_device_orientation
|
|
||||||
sha256: "0c330c068575e4be72cce5968ca479a3f8d5d1e5dfce7d89d5c13a1e943b338c"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.3"
|
|
||||||
nested:
|
nested:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -63,7 +63,6 @@ dependencies:
|
||||||
loggy: ^2.0.3
|
loggy: ^2.0.3
|
||||||
meta: ^1.16.0
|
meta: ^1.16.0
|
||||||
mobile_scanner: ^6.0.7
|
mobile_scanner: ^6.0.7
|
||||||
native_device_orientation: ^2.0.3
|
|
||||||
package_info_plus: ^8.3.0
|
package_info_plus: ^8.3.0
|
||||||
pasteboard: ^0.3.0
|
pasteboard: ^0.3.0
|
||||||
path: ^1.9.1
|
path: ^1.9.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue