Tweak layout for home page. Add title, remove page indicator, reduce bottom padding

This commit is contained in:
Shawn 2022-09-06 09:39:01 -06:00
parent 240b7f05c0
commit 3ae6806b38
5 changed files with 89 additions and 63 deletions

View File

@ -134,6 +134,9 @@ class _Insets {
@immutable @immutable
class _Shadows { class _Shadows {
final textSoft = [
Shadow(color: Colors.black.withOpacity(.25), offset: Offset(0, 2), blurRadius: 4),
];
final text = [ final text = [
Shadow(color: Colors.black.withOpacity(.6), offset: Offset(0, 2), blurRadius: 2), Shadow(color: Colors.black.withOpacity(.6), offset: Offset(0, 2), blurRadius: 2),
]; ];

View File

@ -5,7 +5,7 @@ class DiagonalTextPageIndicator extends StatelessWidget {
const DiagonalTextPageIndicator({Key? key, required this.current, required this.total}) : super(key: key); const DiagonalTextPageIndicator({Key? key, required this.current, required this.total}) : super(key: key);
final int current; final int current;
final int total; final int total;
static const double _fontSize = 32; static const double _fontSize = 26;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -21,10 +21,7 @@ class DiagonalTextPageIndicator extends StatelessWidget {
child: Transform.translate( child: Transform.translate(
offset: Offset(-_fontSize * .7, 0), offset: Offset(-_fontSize * .7, 0),
child: SizedBox( child: SizedBox(
width: size, width: size, height: size, child: Text('0$current', style: textStyle, textAlign: TextAlign.right)),
height: size,
child: Text('0$current',
style: textStyle.copyWith(shadows: $styles.shadows.text), textAlign: TextAlign.right)),
), ),
), ),
ClipPath( ClipPath(
@ -38,7 +35,7 @@ class DiagonalTextPageIndicator extends StatelessWidget {
opacity: .5, opacity: .5,
child: Text( child: Text(
'0$total', '0$total',
style: textStyle.copyWith(shadows: $styles.shadows.textStrong), style: textStyle, //.copyWith(shadows: $styles.shadows.textStrong),
), ),
), ),
), ),

View File

@ -14,6 +14,8 @@ class _TitleText extends StatelessWidget {
children: [ children: [
Gap($styles.insets.md), Gap($styles.insets.md),
Gap(30), Gap(30),
/// Sub-title row
SeparatedRow( SeparatedRow(
padding: EdgeInsets.symmetric(horizontal: $styles.insets.sm), padding: EdgeInsets.symmetric(horizontal: $styles.insets.sm),
separatorBuilder: () => Gap($styles.insets.sm), separatorBuilder: () => Gap($styles.insets.sm),
@ -39,14 +41,23 @@ class _TitleText extends StatelessWidget {
], ],
), ),
Gap($styles.insets.md), Gap($styles.insets.md),
Semantics(sortKey: OrdinalSortKey(0), child: WonderTitleText(data)),
/// Wonder title text
Semantics(
sortKey: OrdinalSortKey(0),
child: WonderTitleText(data),
),
Gap($styles.insets.xs), Gap($styles.insets.xs),
/// Region
Text( Text(
data.regionTitle.toUpperCase(), data.regionTitle.toUpperCase(),
style: $styles.text.title1, style: $styles.text.title1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
Gap($styles.insets.md), Gap($styles.insets.md),
/// Compass divider
ExcludeSemantics( ExcludeSemantics(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: $styles.insets.md), padding: EdgeInsets.symmetric(horizontal: $styles.insets.md),
@ -61,6 +72,8 @@ class _TitleText extends StatelessWidget {
), ),
), ),
Gap($styles.insets.sm), Gap($styles.insets.sm),
/// Date
Text( Text(
StringUtils.supplant( StringUtils.supplant(
$strings.titleLabelDate, $strings.titleLabelDate,

View File

@ -12,6 +12,7 @@ import 'package:wonders/ui/screens/home_menu/home_menu.dart';
import 'package:wonders/ui/wonder_illustrations/common/animated_clouds.dart'; import 'package:wonders/ui/wonder_illustrations/common/animated_clouds.dart';
import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration.dart'; import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration.dart';
import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration_config.dart'; import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration_config.dart';
import 'package:wonders/ui/wonder_illustrations/common/wonder_title_text.dart';
part '_vertical_swipe_controller.dart'; part '_vertical_swipe_controller.dart';
part 'widgets/_animated_arrow_button.dart'; part 'widgets/_animated_arrow_button.dart';
@ -143,7 +144,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
Stack(children: [ Stack(children: [
/// Foreground gradient-1, gets darker when swiping up /// Foreground gradient-1, gets darker when swiping up
BottomCenter( BottomCenter(
child: _buildSwipeableBgGradient(currentWonder.type.bgColor.withOpacity(.5)), child: _buildSwipeableBgGradient(currentWonder.type.bgColor.withOpacity(.65)),
), ),
/// Foreground decorators /// Foreground decorators
@ -151,13 +152,16 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
/// Foreground gradient-2, gets darker when swiping up /// Foreground gradient-2, gets darker when swiping up
BottomCenter( BottomCenter(
child: _buildSwipeableBgGradient(currentWonder.type.bgColor.withOpacity(.5)), child: _buildSwipeableBgGradient(currentWonder.type.bgColor.withOpacity(1)),
), ),
/// Floating controls / UI /// Floating controls / UI
AnimatedSwitcher( AnimatedSwitcher(
duration: $styles.times.fast, duration: $styles.times.fast,
child: RepaintBoundary( child: RepaintBoundary(
key: ObjectKey(currentWonder),
child: IgnorePointer(
ignoringSemantics: false,
child: OverflowBox( child: OverflowBox(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -168,14 +172,13 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
/// Title Content /// Title Content
LightText( LightText(
child: MergeSemantics( child: MergeSemantics(
child: Transform.translate(
offset: Offset(0, 30),
child: Column( child: Column(
children: [ children: [
/// Page indicator WonderTitleText(currentWonder, enableShadows: true),
IgnorePointer(
child: DiagonalTextPageIndicator(current: _wonderIndex + 1, total: _numWonders),
),
Gap($styles.insets.sm),
//Gap($styles.insets.sm),
AppPageIndicator( AppPageIndicator(
count: _numWonders, count: _numWonders,
controller: _pageController, controller: _pageController,
@ -184,11 +187,17 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
onDotPressed: _handlePageIndicatorDotPressed, onDotPressed: _handlePageIndicatorDotPressed,
semanticPageTitle: $strings.homeSemanticWonder, semanticPageTitle: $strings.homeSemanticWonder,
), ),
/// Page indicator
// IgnorePointer(
// child: DiagonalTextPageIndicator(current: _wonderIndex + 1, total: _numWonders),
// ),
], ],
), ),
), ),
), ),
Gap($styles.insets.xs), ),
//Gap($styles.insets.xs),
/// Animated arrow and background /// Animated arrow and background
/// Wrap in a container that is full-width to make it easier to find for screen readers /// Wrap in a container that is full-width to make it easier to find for screen readers
@ -218,6 +227,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
), ),
), ),
), ),
),
/// Menu Btn /// Menu Btn
TopLeft( TopLeft(
@ -306,7 +316,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
return _swipeController.buildListener(builder: (swipeAmt, isPointerDown, _) { return _swipeController.buildListener(builder: (swipeAmt, isPointerDown, _) {
return IgnorePointer( return IgnorePointer(
child: FractionallySizedBox( child: FractionallySizedBox(
heightFactor: .5, heightFactor: .6,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
@ -314,7 +324,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
fgColor.withOpacity(0), fgColor.withOpacity(0),
fgColor.withOpacity(fgColor.opacity * .75 + (isPointerDown ? .05 : 0) + swipeAmt * .20), fgColor.withOpacity(.5 + fgColor.opacity * .25 + (isPointerDown ? .05 : 0) + swipeAmt * .20),
], ],
stops: const [0, 1], stops: const [0, 1],
), ),

View File

@ -40,13 +40,16 @@ class WonderTitleText extends StatelessWidget {
); );
} }
List<Shadow> shadows = enableShadows ? $styles.shadows.text : []; List<Shadow> shadows = enableShadows ? $styles.shadows.textSoft : [];
return RichText( return Hero(
tag: 'wonderTitle-$title',
child: RichText(
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan( text: TextSpan(
style: textStyle.copyWith(shadows: shadows), style: textStyle.copyWith(shadows: shadows),
children: pieces.map(buildTextSpan).toList(), children: pieces.map(buildTextSpan).toList(),
), ),
),
); );
} }
} }