Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile errors #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions flokk_src/lib/_internal/components/animated_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ class _AnimatedPanelState extends State<AnimatedPanel> {
),
duration: Duration(milliseconds: (duration * 1000).round()),
builder: (_, Offset value, Widget? c) {
_isHidden = c == null || widget.isClosed && value == Offset(widget.closedX, widget.closedY);
return _isHidden ? Container() : Transform.translate(offset: value, child: c);
_isHidden = c == null ||
widget.isClosed && value == Offset(widget.closedX, widget.closedY);
return _isHidden
? Container()
: Transform.translate(offset: value, child: c);
},
child: widget.child,
);
Expand All @@ -48,17 +51,38 @@ class _AnimatedPanelState extends State<AnimatedPanel> {

extension AnimatedPanelExtensions on Widget {
Widget animatedPanelX(
{double closeX = 0, bool isClosed = false, double duration = .35, Curve curve = Curves.easeOut}) =>
animatedPanel(closePos: Offset(closeX, 0), isClosed: isClosed, curve: curve, duration: duration);
{double closeX = 0,
bool isClosed = false,
double duration = .35,
Curve curve = Curves.easeOut}) =>
animatedPanel(
closePos: Offset(closeX, 0),
isClosed: isClosed,
curve: curve,
duration: duration);

Widget animatedPanelY(
{double closeY = 0, bool isClosed = false, double duration = .35, Curve curve = Curves.easeOut}) =>
animatedPanel(closePos: Offset(0, closeY), isClosed: isClosed, curve: curve, duration: duration);
{double closeY = 0,
bool isClosed = false,
double duration = .35,
Curve curve = Curves.easeOut}) =>
animatedPanel(
closePos: Offset(0, closeY),
isClosed: isClosed,
curve: curve,
duration: duration);

Widget animatedPanel(
{Offset closePos = Offset.zero, bool isClosed = false, double duration = .35, Curve curve = Curves.easeOut}) {
{Offset closePos = Offset.zero,
bool isClosed = false,
double duration = .35,
Curve curve = Curves.easeOut}) {
return AnimatedPanel(
closedX: closePos.dx, closedY: closePos.dy, child: this, isClosed: isClosed, duration: duration, curve: curve);
closedX: closePos.dx,
closedY: closePos.dy,
child: this,
isClosed: isClosed,
duration: duration,
curve: curve);
}
}

6 changes: 4 additions & 2 deletions flokk_src/lib/_internal/components/animated_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class _AnimatedTextSpikeState extends AnimatedState<AnimatedTextSpike> {
}
}

abstract class AnimatedState<T> extends State with SingleTickerProviderStateMixin {
abstract class AnimatedState<T> extends State
with SingleTickerProviderStateMixin {
late AnimationController animation;

AnimationController createAnim({double lowerBound = 0, double upperBound = 1, double seconds = .2}) {
AnimationController createAnim(
{double lowerBound = 0, double upperBound = 1, double seconds = .2}) {
return AnimationController(
vsync: this,
duration: Duration(milliseconds: (seconds * 1000).round()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/rendering.dart';
extension ClickableExtensions on Widget {
Widget clickable(void Function() action, {bool opaque = true}) {
return GestureDetector(
behavior: opaque? HitTestBehavior.opaque : HitTestBehavior.deferToChild,
behavior: opaque ? HitTestBehavior.opaque : HitTestBehavior.deferToChild,
onTap: action,
child: MouseRegion(
cursor: SystemMouseCursors.click,
Expand Down
5 changes: 4 additions & 1 deletion flokk_src/lib/_internal/components/content_underlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class ContentUnderlay extends StatelessWidget {
final Duration duration;

const ContentUnderlay(
{Key? key, this.color = Colors.black87, this.isActive = true, this.duration = const Duration(milliseconds: 350)})
{Key? key,
this.color = Colors.black87,
this.isActive = true,
this.duration = const Duration(milliseconds: 350)})
: super(key: key);

@override
Expand Down
9 changes: 7 additions & 2 deletions flokk_src/lib/_internal/components/delayed_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ class DelayedBuilder extends StatefulWidget {
final WidgetBuilder secondBuilder;
final double delay;

const DelayedBuilder({Key? key, required this.firstBuilder, required this.secondBuilder, this.delay = 0.0})
const DelayedBuilder(
{Key? key,
required this.firstBuilder,
required this.secondBuilder,
this.delay = 0.0})
: super(key: key);

@override
Expand All @@ -27,5 +31,6 @@ class _DelayedBuilderState extends State<DelayedBuilder> {
}

@override
Widget build(BuildContext context) => !show ? widget.firstBuilder(context) : widget.secondBuilder(context);
Widget build(BuildContext context) =>
!show ? widget.firstBuilder(context) : widget.secondBuilder(context);
}
15 changes: 11 additions & 4 deletions flokk_src/lib/_internal/components/design_grid_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ class GridLayout {
final int numCols;
final double breakPt;

GridLayout({this.gutters = EdgeInsets.zero, this.padding = 0, this.numCols = 0, this.breakPt = 0});
GridLayout(
{this.gutters = EdgeInsets.zero,
this.padding = 0,
this.numCols = 0,
this.breakPt = 0});
}

class DesignGridOverlay extends StatefulWidget {
Expand Down Expand Up @@ -50,7 +54,8 @@ class _DesignGridOverlayState extends State<DesignGridOverlay> {
: widget.child;
}

void handleTap() => setState(() => gridAlpha >= 1 ? gridAlpha = 0 : gridAlpha += .48);
void handleTap() =>
setState(() => gridAlpha >= 1 ? gridAlpha = 0 : gridAlpha += .48);
}

class _DesignGridView extends StatelessWidget {
Expand All @@ -72,8 +77,10 @@ class _DesignGridView extends StatelessWidget {
final List<Widget> content = [Container(width: grid.padding)];
final int numCols = grid.numCols;
for (var i = numCols; i-- > 0;) {
content.add(
Flexible(child: Container(color: Colors.red.withOpacity(state.gridAlpha * .4), height: double.infinity)));
content.add(Flexible(
child: Container(
color: Colors.red.withOpacity(state.gridAlpha * .4),
height: double.infinity)));
content.add(Container(width: grid.padding));
}
print("CurrentBreak: ${grid.breakPt}");
Expand Down
7 changes: 5 additions & 2 deletions flokk_src/lib/_internal/components/mouse_hover_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ typedef Widget HoverBuilder(BuildContext context, bool isHovering);
class MouseHoverBuilder extends StatefulWidget {
final bool isClickable;

MouseHoverBuilder({Key? key, required this.builder, this.isClickable = false}) : super(key: key);
MouseHoverBuilder({Key? key, required this.builder, this.isClickable = false})
: super(key: key);

final HoverBuilder builder;

Expand All @@ -20,7 +21,9 @@ class _MouseHoverBuilderState extends State<MouseHoverBuilder> {
@override
Widget build(BuildContext context) {
return MouseRegion(
cursor: widget.isClickable? SystemMouseCursors.click : SystemMouseCursors.basic,
cursor: widget.isClickable
? SystemMouseCursors.click
: SystemMouseCursors.basic,
onEnter: (p) => setOver(true),
onExit: (p) => setOver(false),
child: widget.builder(context, isOver),
Expand Down
26 changes: 21 additions & 5 deletions flokk_src/lib/_internal/components/multi_value_listenable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class ValueListenableBuilder2<A, B> extends StatelessWidget {
ValueListenableBuilder2({Key? key, required this.value1, required this.value2, required this.builder, this.child}) : super(key: key);
ValueListenableBuilder2(
{Key? key,
required this.value1,
required this.value2,
required this.builder,
this.child})
: super(key: key);

final ValueListenable<A> value1;
final ValueListenable<B> value2;
Expand All @@ -22,13 +28,21 @@ class ValueListenableBuilder2<A, B> extends StatelessWidget {
}

class ValueListenableBuilder3<A, B, C> extends StatelessWidget {
ValueListenableBuilder3({Key? key, required this.value1, required this.value2, required this.value3, required this.builder, this.child}) : super(key: key);
ValueListenableBuilder3(
{Key? key,
required this.value1,
required this.value2,
required this.value3,
required this.builder,
this.child})
: super(key: key);

final ValueListenable<A> value1;
final ValueListenable<B> value2;
final ValueListenable<C> value3;
final Widget? child;
final Widget Function(BuildContext context, A a, B b, C c, Widget? child) builder;
final Widget Function(BuildContext context, A a, B b, C c, Widget? child)
builder;

@override
Widget build(BuildContext context) {
Expand All @@ -44,7 +58,8 @@ class ValueListenableBuilder3<A, B, C> extends StatelessWidget {
}

class ValueListenableBuilder4<A, B, C, D> extends StatelessWidget {
ValueListenableBuilder4(this.value1, this.value2, this.value3, this.value4, {Key? key, required this.builder, this.child})
ValueListenableBuilder4(this.value1, this.value2, this.value3, this.value4,
{Key? key, required this.builder, this.child})
: super(key: key);

final ValueListenable<A> value1;
Expand All @@ -53,7 +68,8 @@ class ValueListenableBuilder4<A, B, C, D> extends StatelessWidget {
final ValueListenable<D> value4;

final Widget? child;
final Widget Function(BuildContext context, A a, B b, C c, D d, Widget? child) builder;
final Widget Function(BuildContext context, A a, B b, C c, D d, Widget? child)
builder;

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'package:flutter/material.dart';

class NoGlowScrollBehavior extends ScrollBehavior {
@override
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
Widget buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) {
return child;
}
}
5 changes: 2 additions & 3 deletions flokk_src/lib/_internal/components/one_line_text.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:flutter/material.dart';

class OneLineText extends StatelessWidget {
Expand All @@ -8,6 +7,6 @@ class OneLineText extends StatelessWidget {
const OneLineText(this.text, {Key? key, this.style}) : super(key: key);

@override
Widget build(BuildContext context) =>
Text(text, style: style, maxLines: 1, softWrap: false, overflow: TextOverflow.fade);
Widget build(BuildContext context) => Text(text,
style: style, maxLines: 1, softWrap: false, overflow: TextOverflow.fade);
}
22 changes: 17 additions & 5 deletions flokk_src/lib/_internal/components/pinned.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ class Pin {
final double? sizePx;
final double? centerPct;

const Pin({this.startPx, this.startPct, this.endPx, this.endPct, this.sizePx, this.centerPct});
const Pin(
{this.startPx,
this.startPct,
this.endPx,
this.endPct,
this.sizePx,
this.centerPct});
}

class Pinned extends StatelessWidget {
final Pin hzPin;
final Pin vtPin;
final Widget? child;

const Pinned({Key? key, required this.hzPin, required this.vtPin, this.child}) : super(key: key);
const Pinned({Key? key, required this.hzPin, required this.vtPin, this.child})
: super(key: key);

_Span calculateSpanFromPin(Pin pin, double maxSize) {
var s = _Span();
Expand Down Expand Up @@ -59,7 +66,8 @@ class Pinned extends StatelessWidget {
@override
Widget build(BuildContext context) {
//Check to see if we have been provided some StackConstraints by [ PinnedStack ]
StackConstraints? constraints = context.dependOnInheritedWidgetOfExactType<StackConstraints>();
StackConstraints? constraints =
context.dependOnInheritedWidgetOfExactType<StackConstraints>();
if (constraints != null) {
return _buildContent(constraints.constraints);
}
Expand All @@ -80,7 +88,10 @@ class Pinned extends StatelessWidget {
offset: Offset(hzSpan.start, vtSpan.start),
child: Align(
alignment: Alignment.topLeft,
child: SizedBox(width: hzSpan.size, height: vtSpan.size, child: showChild ? child : null),
child: SizedBox(
width: hzSpan.size,
height: vtSpan.size,
child: showChild ? child : null),
),
);
}
Expand All @@ -94,5 +105,6 @@ class _Span {
}

extension PinnedExtensions on Widget {
Pinned pin({required Pin hz, required Pin vt}) => Pinned(hzPin: hz, vtPin: vt, child: this);
Pinned pin({required Pin hz, required Pin vt}) =>
Pinned(hzPin: hz, vtPin: vt, child: this);
}
6 changes: 4 additions & 2 deletions flokk_src/lib/_internal/components/pinned_stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import 'package:flutter/material.dart';
class StackConstraints extends InheritedWidget {
final BoxConstraints constraints;

StackConstraints({required this.constraints, required Widget child}) : super(child: child);
StackConstraints({required this.constraints, required Widget child})
: super(child: child);

@override
bool updateShouldNotify(InheritedWidget oldWidget) {
var old = (oldWidget as StackConstraints).constraints;
return old.maxWidth != constraints.maxWidth || old.maxHeight != constraints.maxHeight;
return old.maxWidth != constraints.maxWidth ||
old.maxHeight != constraints.maxHeight;
}
}

Expand Down
7 changes: 6 additions & 1 deletion flokk_src/lib/_internal/components/rotation_3d.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ class Rotation3d extends StatelessWidget {
final double rotationY;
final double rotationZ;

const Rotation3d({Key? key, required this.child, this.rotationX = 0, this.rotationY = 0, this.rotationZ = 0})
const Rotation3d(
{Key? key,
required this.child,
this.rotationX = 0,
this.rotationY = 0,
this.rotationZ = 0})
: super(key: key);

@override
Expand Down
8 changes: 6 additions & 2 deletions flokk_src/lib/_internal/components/scrolling_flex_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class ConstrainedFlexView extends StatelessWidget {
final EdgeInsets scrollPadding;

const ConstrainedFlexView(this.minSize,
{Key? key, required this.child, this.axis = Axis.vertical, this.scrollPadding = const EdgeInsets.all(0)})
{Key? key,
required this.child,
this.axis = Axis.vertical,
this.scrollPadding = const EdgeInsets.all(0)})
: super(key: key);

bool get isHz => axis == Axis.horizontal;
Expand All @@ -25,7 +28,8 @@ class ConstrainedFlexView extends StatelessWidget {
axis: axis,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: isHz ? double.infinity : minSize, maxWidth: isHz ? minSize : double.infinity),
maxHeight: isHz ? double.infinity : minSize,
maxWidth: isHz ? minSize : double.infinity),
child: child,
),
),
Expand Down
Loading