mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
fix: padding issues (#47)
## Pull Request Description This fixes a bunch of padding issues, and also improves padding in other areas. Issue Number: #29 --------- Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
f5343be4e7
commit
6669a06e53
18 changed files with 926 additions and 877 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
|
||||
Future<void> showDialogAdaptive(
|
||||
{required BuildContext context, bool useSafeArea = true, required Widget Function(BuildContext context) builder}) {
|
||||
{required BuildContext context, required Widget Function(BuildContext context) builder}) {
|
||||
if (AdaptiveLayout.of(context).inputDevice == InputDevice.pointer) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useSafeArea: useSafeArea,
|
||||
useSafeArea: false,
|
||||
builder: (context) => Dialog(
|
||||
child: builder(context),
|
||||
),
|
||||
|
|
@ -14,7 +15,7 @@ Future<void> showDialogAdaptive(
|
|||
} else {
|
||||
return showDialog(
|
||||
context: context,
|
||||
useSafeArea: useSafeArea,
|
||||
useSafeArea: false,
|
||||
builder: (context) => Dialog.fullscreen(
|
||||
child: builder(context),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class DefaultTitleBar extends ConsumerStatefulWidget {
|
|||
final String? label;
|
||||
final double? height;
|
||||
final Brightness? brightness;
|
||||
const DefaultTitleBar({this.height = 35, this.label, this.brightness, super.key});
|
||||
const DefaultTitleBar({this.height = defaultTitleBarHeight, this.label, this.brightness, super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ConsumerStatefulWidget> createState() => _DefaultTitleBarState();
|
||||
|
|
@ -161,7 +161,13 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> with WindowLi
|
|||
),
|
||||
],
|
||||
),
|
||||
TargetPlatform.macOS => null,
|
||||
TargetPlatform.macOS => const Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text("Fladder"),
|
||||
SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
_ => Text(widget.label ?? "Fladder"),
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -140,85 +140,87 @@ class _DetailScaffoldState extends ConsumerState<DetailScaffold> {
|
|||
//Top row buttons
|
||||
IconTheme(
|
||||
data: IconThemeData(color: Theme.of(context).colorScheme.onSurface),
|
||||
child: Transform.translate(
|
||||
offset: const Offset(0, kToolbarHeight),
|
||||
child: Padding(
|
||||
padding: MediaQuery.paddingOf(context).add(
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 16),
|
||||
child: IconButton.filledTonal(
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: backGroundColor,
|
||||
),
|
||||
onPressed: () => context.router.popBack(),
|
||||
icon: Padding(
|
||||
padding:
|
||||
EdgeInsets.all(AdaptiveLayout.of(context).inputDevice == InputDevice.pointer ? 0 : 4),
|
||||
child: const Icon(IconsaxOutline.arrow_left_2),
|
||||
),
|
||||
IconButton.filledTonal(
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: backGroundColor,
|
||||
),
|
||||
onPressed: () => context.router.popBack(),
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.all(AdaptiveLayout.of(context).inputDevice == InputDevice.pointer ? 0 : 4),
|
||||
child: const Icon(IconsaxOutline.arrow_left_2),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: backGroundColor, borderRadius: FladderTheme.defaultShape.borderRadius),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.item != null) ...[
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final newActions = widget.actions?.call(context);
|
||||
if (AdaptiveLayout.of(context).inputDevice == InputDevice.pointer) {
|
||||
return PopupMenuButton(
|
||||
tooltip: context.localized.moreOptions,
|
||||
enabled: newActions?.isNotEmpty == true,
|
||||
icon: Icon(widget.item!.type.icon),
|
||||
itemBuilder: (context) => newActions?.popupMenuItems(useIcons: true) ?? [],
|
||||
);
|
||||
} else {
|
||||
return IconButton(
|
||||
onPressed: () => showBottomSheetPill(
|
||||
context: context,
|
||||
content: (context, scrollController) => ListView(
|
||||
controller: scrollController,
|
||||
shrinkWrap: true,
|
||||
children: newActions?.listTileItems(context, useIcons: true) ?? [],
|
||||
),
|
||||
AnimatedSize(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
child: Container(
|
||||
decoration:
|
||||
BoxDecoration(color: backGroundColor, borderRadius: FladderTheme.defaultShape.borderRadius),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.item != null) ...[
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final newActions = widget.actions?.call(context);
|
||||
if (AdaptiveLayout.of(context).inputDevice == InputDevice.pointer) {
|
||||
return PopupMenuButton(
|
||||
tooltip: context.localized.moreOptions,
|
||||
enabled: newActions?.isNotEmpty == true,
|
||||
icon: Icon(widget.item!.type.icon),
|
||||
itemBuilder: (context) => newActions?.popupMenuItems(useIcons: true) ?? [],
|
||||
);
|
||||
} else {
|
||||
return IconButton(
|
||||
onPressed: () => showBottomSheetPill(
|
||||
context: context,
|
||||
content: (context, scrollController) => ListView(
|
||||
controller: scrollController,
|
||||
shrinkWrap: true,
|
||||
children: newActions?.listTileItems(context, useIcons: true) ?? [],
|
||||
),
|
||||
icon: Icon(
|
||||
widget.item!.type.icon,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
if (AdaptiveLayout.of(context).inputDevice == InputDevice.pointer)
|
||||
Builder(
|
||||
builder: (context) => Tooltip(
|
||||
message: context.localized.refresh,
|
||||
child: IconButton(
|
||||
onPressed: () => context.refreshData(),
|
||||
icon: const Icon(IconsaxOutline.refresh),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (AdaptiveLayout.of(context).size == ScreenLayout.single)
|
||||
const SizedBox(height: 30, width: 30, child: SettingsUserIcon()),
|
||||
Tooltip(
|
||||
message: context.localized.home,
|
||||
child: IconButton(
|
||||
onPressed: () => context.router.navigate(const DashboardRoute()),
|
||||
icon: const Icon(IconsaxOutline.home),
|
||||
),
|
||||
),
|
||||
icon: Icon(
|
||||
widget.item!.type.icon,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
if (AdaptiveLayout.of(context).inputDevice == InputDevice.pointer)
|
||||
Builder(
|
||||
builder: (context) => Tooltip(
|
||||
message: context.localized.refresh,
|
||||
child: IconButton(
|
||||
onPressed: () => context.refreshData(),
|
||||
icon: const Icon(IconsaxOutline.refresh),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (AdaptiveLayout.of(context).size == ScreenLayout.single)
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 6),
|
||||
child: const SizedBox(
|
||||
height: 30,
|
||||
width: 30,
|
||||
child: SettingsUserIcon(),
|
||||
),
|
||||
),
|
||||
Tooltip(
|
||||
message: context.localized.home,
|
||||
child: IconButton(
|
||||
onPressed: () => context.router.navigate(const DashboardRoute()),
|
||||
icon: const Icon(IconsaxOutline.home),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue