Skip to content

Commit

Permalink
Merge pull request #405 from AppDaddy-Software-Solutions-Inc/Layout-M…
Browse files Browse the repository at this point in the history
…od-Scroller

Layout mod scroller
  • Loading branch information
TheOlajos authored Jun 13, 2023
2 parents 297d294 + 94d8d12 commit b580c23
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final String applicationTitle = "Flutter Markup Language $version";
// Used in SingleApp only and on Web when developing on localhost
// Set this to file://applications/<app> to use the asset applications

String get defaultDomain => 'https://pad.fml.dev';
String get defaultDomain => 'https://test.appdaddy.co';

// SingleApp - App initializes from a single domain endpoint (defined in defaultDomain)
// MultiApp - (Desktop & Mobile Only) Launches the Store at startup
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/alarm/alarm_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class AlarmModel extends WidgetModel

// Build a binding to the parent value
var binding = "{${parent.id}.value}";
_value = StringObservable(Binding.toKey(id, 'value'),binding, scope: scope);
_value ??= StringObservable(Binding.toKey(id, 'value'),binding, scope: scope);
}

static AlarmModel? fromXml(WidgetModel parent, XmlElement xml)
Expand Down
4 changes: 0 additions & 4 deletions lib/widgets/animation/animation_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class AnimationViewState extends WidgetState<AnimationView> with TickerProviderS
AnimationController? _controller;
Widget? transitionChild;

bool _stopped = false;

@override
void initState()
{
Expand Down Expand Up @@ -160,7 +158,6 @@ class AnimationViewState extends WidgetState<AnimationView> with TickerProviderS

void start() {
try {
_stopped = false;
if(widget.model.hasrun) return;
if (_controller!.isCompleted) {
if(widget.model.runonce) widget.model.hasrun = true;
Expand All @@ -186,7 +183,6 @@ class AnimationViewState extends WidgetState<AnimationView> with TickerProviderS

void stop() {
try {
_stopped = true;
_controller!.reset();
widget.model.controllerValue = 0;
_controller!.stop();
Expand Down
21 changes: 21 additions & 0 deletions lib/widgets/box/box_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,33 @@ mixin BoxMixin
constraints = BoxConstraints(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth, minHeight: constraints.minHeight, maxHeight: parentHeight);
}

// if the model wants to expand in the horizontal and has an unbounded
// width, then set the min width to the parent width. This happens for
// instance when a <box expand="true"/> is inside a <scroller/>. Normally the
// expand would be set to false in the view. This ensures the widget is at least as
// wide as the first parent with a constrained width.
// if (model.expandHorizontally && !constraints.hasBoundedWidth)
// {
// constraints = BoxConstraints(minWidth: parentWidth, maxWidth: constraints.maxWidth, minHeight: constraints.minHeight, maxHeight: constraints.maxHeight);
// }

// if the model wants to expand in the vertical and has an unbounded
// height, then set the min height to the parent height. This happens for
// instance when a <box expand="true"/> is inside a <scroller/>. Normally the
// expand would be set to false in the view. This ensures the widget is at least as
// high as the first parent with a constrained height.
// if (model.expandVertically && !constraints.hasBoundedHeight)
// {
// constraints = BoxConstraints(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth, minHeight: parentHeight, maxHeight: constraints.maxHeight);
// }

// visible?
if (!model.visible)
{
constraints = BoxConstraints(minWidth: 0, maxWidth: 0, minHeight: 0, maxHeight: 0);
}

// normalize
return constraints.normalize();
}
}
19 changes: 1 addition & 18 deletions lib/widgets/scroller/scroller_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ class ScrollerModel extends BoxModel
}
}

/// We want the scroller to expand in it main axis by default
/// and share space with its siblings. The scroller expands naturally in its
/// cross axis unless expand="false"
/// This can be done by returning a flex=1 to the parent box
/// layout renderer
// @override
// int? get flex
// {
// if (super.flex != null) return super.flex;
// if (layoutType == LayoutType.row && !hasBoundedWidth && !expand) return 1;
// if (layoutType == LayoutType.column && !hasBoundedHeight && !expand) return 1;
// return null;
// }

/// If true will display a scrollbar, just used as a backup if flutter's built in scrollbar doesn't work
BooleanObservable? _scrollbar;
set scrollbar (dynamic v)
Expand Down Expand Up @@ -165,10 +151,7 @@ class ScrollerModel extends BoxModel
BoxModel getContentModel()
{
// build the _body model
if (_body == null)
{
_body = (layoutType == LayoutType.row) ? RowModel(this, null) : ColumnModel(this, null);
}
_body ??= (layoutType == LayoutType.row) ? RowModel(this, null) : ColumnModel(this, null);

// add my children to content
_body!.children = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/text/text_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class _TextViewState extends WidgetState<TextView>

var style = TextStyle(
fontSize: widget.model.size ?? textStyle!.fontSize,
color: widget.model.color,
color: widget.model.color ?? theme?.colorScheme.onBackground,
fontWeight: widget.model.bold ? FontWeight.bold : textStyle!.fontWeight,
fontStyle: widget.model.italic ? FontStyle.italic : textStyle!.fontStyle,
decoration: textDecoration);
Expand Down

0 comments on commit b580c23

Please sign in to comment.