Skip to content

Commit b4163f2

Browse files
Merge pull request #337 from StacDev/p2-widgets
DSL Widgets : added StacCarouselView, StacGridView, StacSliverAppBar, StacAutoComplete, StacDropDownMenu
2 parents ef098ea + 869e829 commit b4163f2

File tree

48 files changed

+1897
-4328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1897
-4328
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ mason-lock.json
4040
.netlify
4141

4242
# Cursor Files
43-
.cursor/
43+
.cursor/

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

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import 'package:stac/src/parsers/painting/stac_text_style_parser.dart';
1111
import 'package:stac/src/utils/color_utils.dart';
1212
import 'package:stac/src/utils/input_formatters.dart';
1313
import 'package:stac_models/stac_models.dart';
14+
import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart';
1415
import 'package:stac_models/theme/stac_button_style/stac_button_style.dart';
16+
import 'package:stac_models/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart';
1517
import 'package:stac_models/types/stac_alignment.dart';
1618
import 'package:stac_models/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart';
1719
import 'package:stac_models/types/stac_blur_style.dart';
@@ -1146,6 +1148,83 @@ extension StacAxisParser on StacAxis {
11461148
}
11471149
}
11481150

1151+
extension StacInputDecorationThemeParser on StacInputDecorationTheme? {
1152+
InputDecorationTheme parse(BuildContext context) {
1153+
FloatingLabelBehavior parseFloatingLabelBehavior(String? behavior) {
1154+
switch (behavior) {
1155+
case 'always':
1156+
return FloatingLabelBehavior.always;
1157+
case 'never':
1158+
return FloatingLabelBehavior.never;
1159+
case 'auto':
1160+
default:
1161+
return FloatingLabelBehavior.auto;
1162+
}
1163+
}
1164+
1165+
FloatingLabelAlignment parseFloatingLabelAlignment(String? alignment) {
1166+
switch (alignment) {
1167+
case 'center':
1168+
return FloatingLabelAlignment.center;
1169+
case 'start':
1170+
default:
1171+
return FloatingLabelAlignment.start;
1172+
}
1173+
}
1174+
1175+
return InputDecorationTheme(
1176+
labelStyle: this?.labelStyle?.parse(context),
1177+
floatingLabelStyle: this?.floatingLabelStyle?.parse(context),
1178+
helperStyle: this?.helperStyle?.parse(context),
1179+
helperMaxLines: this?.helperMaxLines,
1180+
hintStyle: this?.hintStyle?.parse(context),
1181+
errorStyle: this?.errorStyle?.parse(context),
1182+
errorMaxLines: this?.errorMaxLines,
1183+
floatingLabelBehavior:
1184+
parseFloatingLabelBehavior(this?.floatingLabelBehavior),
1185+
floatingLabelAlignment:
1186+
parseFloatingLabelAlignment(this?.floatingLabelAlignment),
1187+
isDense: this?.isDense ?? false,
1188+
contentPadding: this?.contentPadding?.parse,
1189+
isCollapsed: this?.isCollapsed ?? false,
1190+
iconColor: this?.iconColor.toColor(context),
1191+
prefixStyle: this?.prefixStyle?.parse(context),
1192+
prefixIconColor: this?.prefixIconColor.toColor(context),
1193+
suffixStyle: this?.suffixStyle?.parse(context),
1194+
suffixIconColor: this?.suffixIconColor.toColor(context),
1195+
counterStyle: this?.counterStyle?.parse(context),
1196+
filled: this?.filled ?? false,
1197+
fillColor: this?.fillColor.toColor(context),
1198+
alignLabelWithHint: this?.alignLabelWithHint ?? false,
1199+
constraints: this?.constraints?.parse,
1200+
);
1201+
}
1202+
}
1203+
1204+
extension StacDropdownMenuEntryParser on StacDropdownMenuEntry? {
1205+
DropdownMenuEntry? parse(BuildContext context) {
1206+
return DropdownMenuEntry(
1207+
value: this?.value,
1208+
label: this?.label ?? '',
1209+
labelWidget: this?.labelWidget?.parse(context),
1210+
leadingIcon: this?.leadingIcon?.parse(context),
1211+
enabled: this?.enabled ?? true,
1212+
style: this?.style?.parseTextButton(context),
1213+
);
1214+
}
1215+
}
1216+
1217+
extension StacOptionsViewOpenDirectionParser on StacOptionsViewOpenDirection {
1218+
OptionsViewOpenDirection get parse {
1219+
switch (this) {
1220+
case StacOptionsViewOpenDirection.up:
1221+
return OptionsViewOpenDirection.up;
1222+
case StacOptionsViewOpenDirection.down:
1223+
return OptionsViewOpenDirection.down;
1224+
}
1225+
}
1226+
}
1227+
11491228
/// Extends [StacRefreshIndicatorTriggerMode] to provide parsing functionality.
11501229
extension StacRefreshIndicatorTriggerModeParser
11511230
on StacRefreshIndicatorTriggerMode {

packages/stac/lib/src/parsers/widgets/stac_auto_complete/stac_auto_complete.dart

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)