Skip to content

Commit bf840ab

Browse files
authored
Merge pull request #87 from gluestack/development
Development
2 parents 9f7f626 + f205a2d commit bf840ab

File tree

240 files changed

+26277
-2558
lines changed

Some content is hidden

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

240 files changed

+26277
-2558
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ migrate_working_dir/
2929
build/
3030
.flutter-plugins
3131
.flutter-plugins-dependencies
32+
android/local.properties
33+
ios/
34+

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@
66

77
- Remove provider dependency from package.
88
- Update example to manage light and dark theme.
9+
10+
## 0.0.1-alpha.3
11+
12+
- Add `GluestackProvider`
13+
- Add support to set custom values for design tokens through GluestackProvider.
14+
- New widget: added Forms
15+
- Add responsiveness to existing widgets.
16+
- Update example app with new widgets.

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Add the package to your dependencies:
3030

3131
```yaml
3232
dependencies:
33-
gluestack_ui: 0.0.1-alpha.2
33+
gluestack_ui: 0.0.1-alpha.3
3434
```
3535
3636
OR
@@ -43,7 +43,16 @@ dependencies:
4343
4444
## Usage
4545
46-
Here is how `GSButton` widget can be easily integrated into your flutter app. Here's an example of how to use it:
46+
Wrap the `MaterialApp` with `GluestackProvider`.
47+
48+
```dart
49+
GluestackProvider(
50+
child: MaterialApp.router(
51+
....
52+
)
53+
```
54+
55+
Here's an example of how to use `GSButton` widget into your flutter app:
4756

4857
```dart
4958
import 'package:gluestack_ui/gluestack_ui.dart';
@@ -73,6 +82,29 @@ GSButton(
7382

7483
All Gluestack widgets support dark theme. Package detects the current theme from Flutter's inbuilt `Theme.of(context).brightness`. Hence, you can manage the theme mode from MaterialApp itself using the state management of your choice.
7584

85+
## Custom tokens
86+
87+
You can customize the default tokens to provide your own design values.
88+
89+
```dart
90+
GluestackProvider(
91+
gluestackTokenConfig: GluestackTokenConfig(
92+
gsColorsToken: const GSColorsToken(
93+
primary600: Colors.pink,
94+
primary700: Colors.pink,
95+
),
96+
gsFontSizeToken: const GSFontSizeToken(
97+
$sm: 12,
98+
$md: 14,
99+
),
100+
// More token configurations....
101+
),
102+
child: MaterialApp.router(
103+
....
104+
),
105+
)
106+
```
107+
76108
## Contributing
77109

78110
We welcome contributions from the community. If you'd like to contribute to `gluestack-ui-flutter`, please read our [contributing guide](./CONTRIBUTING.md) instructions on how to submit a pull request.

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.history
1010
.svn/
1111
migrate_working_dir/
12+
*.lock
1213

1314
# IntelliJ related
1415
*.iml

example/lib/example/KitchenSink/components/banner.dart

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

example/lib/example/KitchenSink/main_page.dart

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

example/lib/example/checkbox_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class _CheckBoxExampleState extends State<CheckBoxExample> {
5858
code: code,
5959
component: GSCheckBox(
6060
icon: GSCheckBoxIndicator(
61-
style: GSStyle(margin: const EdgeInsets.only(right: $GSSpace.$2)),
61+
style: GSStyle(margin: EdgeInsets.only(right: $GSSpace.$2)),
6262
child: const GSCheckBoxIcon(),
6363
),
6464
value: "value 1",

example/lib/example/fab_example.dart

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:gluestack_ui/gluestack_ui.dart';
3+
import 'package:gluestack_ui_example/utils/base_layout.dart';
4+
import 'package:gluestack_ui_example/utils/drop_down.dart';
5+
import 'package:gluestack_ui_example/utils/toggle.dart';
6+
7+
class FabExample extends StatefulWidget {
8+
const FabExample({super.key});
9+
10+
@override
11+
State<FabExample> createState() => _FabExampleState();
12+
}
13+
14+
class _FabExampleState extends State<FabExample> {
15+
final List dropdownSizeOptions = [GSSizes.$sm, GSSizes.$md, GSSizes.$lg];
16+
final List dropdownPlacementOptions = [
17+
GSPlacements.bottomCenter,
18+
GSPlacements.bottomLeft,
19+
GSPlacements.bottomRight,
20+
GSPlacements.topCenter,
21+
GSPlacements.topLeft,
22+
GSPlacements.topRight
23+
];
24+
GSSizes selectedSizeOption = GSSizes.$md;
25+
GSPlacements selectedPlacementOption = GSPlacements.bottomRight;
26+
bool isDisabled = false;
27+
bool isHovered = false;
28+
bool isPressed = false;
29+
void updateSizeSelectedOption(dynamic newOption) {
30+
setState(() {
31+
selectedSizeOption = newOption;
32+
});
33+
}
34+
35+
void updatePlacementSelectedOption(dynamic newOption) {
36+
setState(() {
37+
selectedPlacementOption = newOption;
38+
});
39+
}
40+
41+
void updateIsDisabled(bool value) {
42+
setState(() {
43+
isDisabled = value;
44+
});
45+
}
46+
47+
void updateIsHovered(bool value) {
48+
setState(() {
49+
isHovered = value;
50+
});
51+
}
52+
53+
void updateIsPressed(bool value) {
54+
setState(() {
55+
isPressed = value;
56+
});
57+
}
58+
59+
@override
60+
Widget build(BuildContext context) {
61+
return Scaffold(
62+
appBar: AppBar(),
63+
body: BaseLayout(
64+
component: Center(
65+
child: Stack(
66+
children: [
67+
GSBox(
68+
style: GSStyle(
69+
height: 360,
70+
width: 320,
71+
borderRadius: $GSRadii.$md,
72+
bg: $GSColors.backgroundLight50,
73+
dark: GSStyle(color: $GSColors.backgroundDark900)),
74+
),
75+
GSFab(
76+
size: selectedSizeOption,
77+
placement: selectedPlacementOption,
78+
onPressed: () {},
79+
isDisabled: isDisabled,
80+
isHovered: isHovered,
81+
isPressed: isPressed,
82+
icon: const GSFabIcon(icon: Icons.add),
83+
label: const GSFabLabel(text: 'Quick Start'),
84+
),
85+
],
86+
),
87+
),
88+
controls: Column(
89+
mainAxisAlignment: MainAxisAlignment.spaceAround,
90+
crossAxisAlignment: CrossAxisAlignment.start,
91+
children: [
92+
CustomDropDown(
93+
title: "size",
94+
dropdownOptions: dropdownSizeOptions,
95+
selectedOption: selectedSizeOption,
96+
onChanged: updateSizeSelectedOption,
97+
),
98+
CustomDropDown(
99+
title: "placement",
100+
dropdownOptions: dropdownPlacementOptions,
101+
selectedOption: selectedPlacementOption,
102+
onChanged: updatePlacementSelectedOption,
103+
),
104+
105+
const SizedBox(height: 20),
106+
CustomToggle(
107+
title: "isDisabled",
108+
value: isDisabled,
109+
onToggle: updateIsDisabled,
110+
),
111+
const SizedBox(height: 20),
112+
CustomToggle(
113+
title: "isHovered",
114+
value: isHovered,
115+
onToggle: updateIsHovered,
116+
),
117+
const SizedBox(height: 20),
118+
CustomToggle(
119+
title: "isPressed",
120+
value: isPressed,
121+
onToggle: updateIsPressed,
122+
),
123+
// CustomToggle(
124+
// title: "isInvalid",
125+
// value: isInvalid,
126+
// onToggle: updateIsInvalid,
127+
// )
128+
],
129+
),
130+
),
131+
);
132+
}
133+
}

0 commit comments

Comments
 (0)