mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
feature: Rework responsive layout (#217)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
e07f280124
commit
8012fdcea8
48 changed files with 1468 additions and 1040 deletions
|
|
@ -1,20 +1,25 @@
|
|||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:fladder/models/settings/home_settings_model.dart';
|
||||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
|
||||
class HideOnScroll extends ConsumerStatefulWidget {
|
||||
final Widget? child;
|
||||
final ScrollController? controller;
|
||||
final double height;
|
||||
final Widget? Function(bool visible)? visibleBuilder;
|
||||
final Duration duration;
|
||||
final bool forceHide;
|
||||
const HideOnScroll({
|
||||
this.child,
|
||||
this.controller,
|
||||
this.height = kBottomNavigationBarHeight,
|
||||
this.visibleBuilder,
|
||||
this.duration = const Duration(milliseconds: 200),
|
||||
this.forceHide = false,
|
||||
super.key,
|
||||
}) : assert(child != null || visibleBuilder != null);
|
||||
|
||||
|
|
@ -63,12 +68,16 @@ class _HideOnScrollState extends ConsumerState<HideOnScroll> {
|
|||
Widget build(BuildContext context) {
|
||||
if (widget.visibleBuilder != null) return widget.visibleBuilder!(isVisible)!;
|
||||
if (widget.child == null) return const SizedBox();
|
||||
if (AdaptiveLayout.of(context).layout == LayoutState.desktop) {
|
||||
if (AdaptiveLayout.viewSizeOf(context) == ViewSize.desktop) {
|
||||
return widget.child!;
|
||||
} else {
|
||||
return AnimatedAlign(
|
||||
alignment: const Alignment(0, -1),
|
||||
heightFactor: isVisible ? 1.0 : 0,
|
||||
heightFactor: widget.forceHide
|
||||
? 0
|
||||
: isVisible
|
||||
? 1.0
|
||||
: 0,
|
||||
duration: widget.duration,
|
||||
child: Wrap(children: [widget.child!]),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue