From 891911dfbff6600181c28f2a89457d22ada85f27 Mon Sep 17 00:00:00 2001 From: danielmolnar Date: Tue, 9 May 2023 16:59:32 +0200 Subject: [PATCH 1/4] Add vertical padding --- .../widgets/backdrop/step_page_scaffold.dart | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/src/core/widgets/backdrop/step_page_scaffold.dart b/lib/src/core/widgets/backdrop/step_page_scaffold.dart index fde3648e..f1cfccf3 100644 --- a/lib/src/core/widgets/backdrop/step_page_scaffold.dart +++ b/lib/src/core/widgets/backdrop/step_page_scaffold.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:math' as math; +import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:wiredash/src/_wiredash_internal.dart'; @@ -98,6 +99,8 @@ class StepPageScaffoldState extends State { double _minHeight = 0.0; + static const _verticalPadding = 8.0; + @override void didChangeDependencies() { super.didChangeDependencies(); @@ -112,6 +115,8 @@ class StepPageScaffoldState extends State { @override Widget build(BuildContext context) { + final viewPadding = MediaQuery.of(context).viewPadding; + return Align( alignment: Alignment.topLeft, child: ScrollBox( @@ -121,7 +126,10 @@ class StepPageScaffoldState extends State { _reportWidgetHeight(); }, child: SafeArea( - minimum: const EdgeInsets.symmetric(vertical: 24), + minimum: EdgeInsets.only( + top: viewPadding.top + _verticalPadding, + bottom: viewPadding.bottom + _verticalPadding, + ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: () { @@ -148,13 +156,11 @@ class StepPageScaffoldState extends State { child: widget.indicator, ), ), - if (widget.breadcrumbTitle != null && - context.theme.windowSize.width > 400) ...[ + if (widget.breadcrumbTitle != null && context.theme.windowSize.width > 400) ...[ SizedBox( height: 16, child: VerticalDivider( - color: - context.theme.secondaryTextOnBackgroundColor, + color: context.theme.secondaryTextOnBackgroundColor, ), ), Expanded( @@ -197,8 +203,7 @@ class StepPageScaffoldState extends State { setState(() { if (_reallyTimer == null) { setState(() { - _reallyTimer = - Timer(const Duration(seconds: 3), () { + _reallyTimer = Timer(const Duration(seconds: 3), () { if (mounted) { setState(() { _reallyTimer = null; @@ -209,8 +214,7 @@ class StepPageScaffoldState extends State { }); }); } else { - context.wiredashModel - .hide(discardFeedback: true); + context.wiredashModel.hide(discardFeedback: true); _reallyTimer = null; } }); @@ -224,8 +228,7 @@ class StepPageScaffoldState extends State { ) : DefaultTextStyle( style: context.text.caption.onBackground, - child: widget.discardConfirmLabel ?? - const Text('Really?'), + child: widget.discardConfirmLabel ?? const Text('Really?'), ), ), ] @@ -262,8 +265,7 @@ class StepPageScaffoldState extends State { } // make height a multiple of 64 (round up) to prevent micro animations const double multipleOf = 64; - final multipleHeight = - (_measuredSize.height / multipleOf).ceil() * multipleOf; + final multipleHeight = (_measuredSize.height / multipleOf).ceil() * multipleOf; final minHeight = widget.minHeight ?? context.theme.minContentHeight; final height = math.max(multipleHeight, minHeight); @@ -321,8 +323,7 @@ class _ScrollBoxState extends State { child: widget.child, ); final targetPlatform = Theme.of(context).platform; - final bool isTouchInput = targetPlatform == TargetPlatform.iOS || - targetPlatform == TargetPlatform.android; + final bool isTouchInput = targetPlatform == TargetPlatform.iOS || targetPlatform == TargetPlatform.android; if (isTouchInput) { child = Scrollbar( interactive: false, From e028b21d7b9808b96af6f41b0a46d5c4d97c8551 Mon Sep 17 00:00:00 2001 From: danielmolnar Date: Wed, 10 May 2023 12:59:07 +0200 Subject: [PATCH 2/4] Use 80 line length --- .../widgets/backdrop/step_page_scaffold.dart | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/src/core/widgets/backdrop/step_page_scaffold.dart b/lib/src/core/widgets/backdrop/step_page_scaffold.dart index f1cfccf3..69bcd597 100644 --- a/lib/src/core/widgets/backdrop/step_page_scaffold.dart +++ b/lib/src/core/widgets/backdrop/step_page_scaffold.dart @@ -156,11 +156,13 @@ class StepPageScaffoldState extends State { child: widget.indicator, ), ), - if (widget.breadcrumbTitle != null && context.theme.windowSize.width > 400) ...[ + if (widget.breadcrumbTitle != null && + context.theme.windowSize.width > 400) ...[ SizedBox( height: 16, child: VerticalDivider( - color: context.theme.secondaryTextOnBackgroundColor, + color: + context.theme.secondaryTextOnBackgroundColor, ), ), Expanded( @@ -203,7 +205,8 @@ class StepPageScaffoldState extends State { setState(() { if (_reallyTimer == null) { setState(() { - _reallyTimer = Timer(const Duration(seconds: 3), () { + _reallyTimer = + Timer(const Duration(seconds: 3), () { if (mounted) { setState(() { _reallyTimer = null; @@ -214,7 +217,8 @@ class StepPageScaffoldState extends State { }); }); } else { - context.wiredashModel.hide(discardFeedback: true); + context.wiredashModel + .hide(discardFeedback: true); _reallyTimer = null; } }); @@ -228,7 +232,8 @@ class StepPageScaffoldState extends State { ) : DefaultTextStyle( style: context.text.caption.onBackground, - child: widget.discardConfirmLabel ?? const Text('Really?'), + child: widget.discardConfirmLabel ?? + const Text('Really?'), ), ), ] @@ -265,7 +270,8 @@ class StepPageScaffoldState extends State { } // make height a multiple of 64 (round up) to prevent micro animations const double multipleOf = 64; - final multipleHeight = (_measuredSize.height / multipleOf).ceil() * multipleOf; + final multipleHeight = + (_measuredSize.height / multipleOf).ceil() * multipleOf; final minHeight = widget.minHeight ?? context.theme.minContentHeight; final height = math.max(multipleHeight, minHeight); @@ -323,7 +329,8 @@ class _ScrollBoxState extends State { child: widget.child, ); final targetPlatform = Theme.of(context).platform; - final bool isTouchInput = targetPlatform == TargetPlatform.iOS || targetPlatform == TargetPlatform.android; + final bool isTouchInput = targetPlatform == TargetPlatform.iOS || + targetPlatform == TargetPlatform.android; if (isTouchInput) { child = Scrollbar( interactive: false, From 9f909537a08e9004534ef225cdf59c50e48a7b70 Mon Sep 17 00:00:00 2001 From: danielmolnar Date: Wed, 10 May 2023 13:11:02 +0200 Subject: [PATCH 3/4] Fix format --- lib/src/core/widgets/backdrop/step_page_scaffold.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/src/core/widgets/backdrop/step_page_scaffold.dart b/lib/src/core/widgets/backdrop/step_page_scaffold.dart index 69bcd597..8a093fb4 100644 --- a/lib/src/core/widgets/backdrop/step_page_scaffold.dart +++ b/lib/src/core/widgets/backdrop/step_page_scaffold.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:math' as math; -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:wiredash/src/_wiredash_internal.dart'; From 8b5145ed1e44468c623eb0014b351f9191f48174 Mon Sep 17 00:00:00 2001 From: danielmolnar Date: Wed, 10 May 2023 14:47:20 +0200 Subject: [PATCH 4/4] Consider web and mobile --- .../widgets/backdrop/step_page_scaffold.dart | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/src/core/widgets/backdrop/step_page_scaffold.dart b/lib/src/core/widgets/backdrop/step_page_scaffold.dart index 8a093fb4..fef36671 100644 --- a/lib/src/core/widgets/backdrop/step_page_scaffold.dart +++ b/lib/src/core/widgets/backdrop/step_page_scaffold.dart @@ -98,8 +98,6 @@ class StepPageScaffoldState extends State { double _minHeight = 0.0; - static const _verticalPadding = 8.0; - @override void didChangeDependencies() { super.didChangeDependencies(); @@ -114,8 +112,6 @@ class StepPageScaffoldState extends State { @override Widget build(BuildContext context) { - final viewPadding = MediaQuery.of(context).viewPadding; - return Align( alignment: Alignment.topLeft, child: ScrollBox( @@ -125,10 +121,17 @@ class StepPageScaffoldState extends State { _reportWidgetHeight(); }, child: SafeArea( - minimum: EdgeInsets.only( - top: viewPadding.top + _verticalPadding, - bottom: viewPadding.bottom + _verticalPadding, - ), + minimum: () { + const min = 24.0; + const extra = 8.0; + final viewPadding = MediaQuery.of(context).viewPadding; + final top = math.max(min, viewPadding.top + extra); + final bottom = math.max(min, viewPadding.bottom + extra); + return EdgeInsets.only( + top: top, + bottom: bottom, + ); + }(), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: () {