Skip to content

Commit 2cb8aa1

Browse files
committed
bugfixes
1 parent 0eb7ac8 commit 2cb8aa1

File tree

13 files changed

+84
-32
lines changed

13 files changed

+84
-32
lines changed

packages/stac/lib/src/parsers/types/type_parser.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:stac/src/utils/color_utils.dart';
77
import 'package:stac_models/stac_models.dart';
88
import 'package:stac_models/theme/stac_button_style/stac_button_style.dart';
99
import 'package:stac_models/types/stac_alignment.dart';
10-
import 'package:stac_models/types/stac_axis.dart';
1110
import 'package:stac_models/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart';
1211
import 'package:stac_models/types/stac_blur_style.dart';
1312
import 'package:stac_models/types/stac_border/stac_border.dart';
@@ -16,7 +15,6 @@ import 'package:stac_models/types/stac_box_fit.dart';
1615
import 'package:stac_models/types/stac_box_shadow/stac_box_shadow.dart';
1716
import 'package:stac_models/types/stac_box_shape.dart';
1817
import 'package:stac_models/types/stac_circle_border/stac_circle_border.dart';
19-
import 'package:stac_models/types/stac_clip.dart';
2018
import 'package:stac_models/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart';
2119
import 'package:stac_models/types/stac_cross_axis_alignment.dart';
2220
import 'package:stac_models/types/stac_filter_quality.dart';

packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StacDrawerParser extends StacParser<StacDrawer> {
2626
shape: model.shape?.parse(context),
2727
width: model.width,
2828
semanticLabel: model.semanticLabel,
29-
clipBehavior: model.clipBehavior,
29+
clipBehavior: model.clipBehavior?.parse,
3030
child: model.child?.parse(context),
3131
);
3232
}

packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:stac/src/utils/color_utils.dart';
99
import 'package:stac/src/utils/widget_type.dart';
1010
import 'package:stac_framework/stac_framework.dart';
1111
import 'package:stac_models/widgets/tab_bar/stac_tab_bar.dart';
12+
import 'package:stac_models/types/types.dart';
1213

1314
class StacTabBarParser extends StacParser<StacTabBar> {
1415
const StacTabBarParser({this.controller});
@@ -35,7 +36,15 @@ class StacTabBarParser extends StacParser<StacTabBar> {
3536
indicatorWeight: model.indicatorWeight ?? 2.0,
3637
indicatorPadding: model.indicatorPadding?.parse ?? EdgeInsets.zero,
3738
indicator: model.indicator?.parse(context),
38-
indicatorSize: model.indicatorSize,
39+
indicatorSize: () {
40+
switch (model.indicatorSize) {
41+
case StacTabBarIndicatorSize.label:
42+
return TabBarIndicatorSize.label;
43+
case StacTabBarIndicatorSize.tab:
44+
default:
45+
return TabBarIndicatorSize.tab;
46+
}
47+
}(),
3948
labelColor: model.labelColor?.toColor(context),
4049
labelStyle: model.labelStyle?.parse(context),
4150
labelPadding: model.labelPadding?.parse,
@@ -46,7 +55,19 @@ class StacTabBarParser extends StacParser<StacTabBar> {
4655
enableFeedback: model.enableFeedback,
4756
onTap: (_) {},
4857
physics: model.physics?.parse,
49-
tabAlignment: model.tabAlignment,
58+
tabAlignment: () {
59+
switch (model.tabAlignment) {
60+
case StacTabAlignment.center:
61+
return TabAlignment.center;
62+
case StacTabAlignment.fill:
63+
return TabAlignment.fill;
64+
case StacTabAlignment.startOffset:
65+
return TabAlignment.startOffset;
66+
case StacTabAlignment.start:
67+
default:
68+
return TabAlignment.start;
69+
}
70+
}(),
5071
dividerColor: model.dividerColor?.toColor(context),
5172
dividerHeight: model.dividerHeight,
5273
);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// Controls how tabs are aligned within a TabBar.
2+
///
3+
/// Maps to Flutter's TabAlignment (Material 3).
4+
enum StacTabAlignment {
5+
/// Align tabs to the start.
6+
start,
7+
8+
/// Align tabs to the start with additional offset behavior.
9+
startOffset,
10+
11+
/// Stretch tabs to fill the available width.
12+
fill,
13+
14+
/// Center tabs in the available width.
15+
center,
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// Defines how the tab indicator's size is computed.
2+
///
3+
/// Maps to Flutter's TabBarIndicatorSize.
4+
enum StacTabBarIndicatorSize {
5+
/// Indicator will match the entire tab's width.
6+
tab,
7+
8+
/// Indicator will match the width of the tab's label.
9+
label,
10+
}

packages/stac_models/lib/types/types.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ export 'stac_rect/stac_rect.dart';
3838
export 'stac_rect_tween/stac_rect_tween.dart';
3939
export 'stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart';
4040
export 'stac_axis.dart';
41+
export 'stac_tab_bar_indicator_size.dart';
42+
export 'stac_tab_alignment.dart';

packages/stac_models/lib/widgets/drawer/stac_drawer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import 'package:flutter/material.dart';
21
import 'package:json_annotation/json_annotation.dart';
32
import 'package:stac_models/core/converters/double_converter.dart';
43
import 'package:stac_models/core/stac_widget.dart';
54
import 'package:stac_models/painting/stac_color/stac_colors.dart';
65
import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart';
6+
import 'package:stac_models/types/stac_clip.dart';
77

88
part 'stac_drawer.g.dart';
99

@@ -96,7 +96,7 @@ class StacDrawer extends StacWidget {
9696
final String? semanticLabel;
9797

9898
/// The clip behavior for the drawer's content.
99-
final Clip? clipBehavior;
99+
final StacClip? clipBehavior;
100100

101101
/// Widget type identifier for this model.
102102
@override

packages/stac_models/lib/widgets/drawer/stac_drawer.g.dart

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:json_annotation/json_annotation.dart';
22
import 'package:stac_models/stac_models.dart';
33
import 'package:stac_models/theme/stac_button_style/stac_button_style.dart';
4-
import 'package:stac_models/types/stac_clip.dart';
54

65
part 'stac_outlined_button.g.dart';
76

packages/stac_models/lib/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import 'package:json_annotation/json_annotation.dart';
2-
import 'package:stac_models/stac_models.dart';
2+
import 'package:stac_models/core/stac_widget.dart';
3+
import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart';
34
import 'package:stac_models/types/stac_axis.dart';
45
import 'package:stac_models/types/stac_clip.dart';
6+
import 'package:stac_models/types/stac_drag_start_behavior.dart';
7+
import 'package:stac_models/types/stac_scroll_physics.dart';
8+
import 'package:stac_models/types/stac_scroll_view_keyboard_dismiss_behavior.dart';
59

610
part 'stac_single_child_scroll_view.g.dart';
711

0 commit comments

Comments
 (0)