Skip to content

Commit 9f7f626

Browse files
authored
Merge pull request #69 from gluestack/development
Development
2 parents 72d1214 + 1a834e9 commit 9f7f626

36 files changed

+567
-559
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
## 0.0.1-alpha.1
22

33
- Initial alpha release.
4+
5+
## 0.0.1-alpha.2
6+
7+
- Remove provider dependency from package.
8+
- Update example to manage light and dark theme.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _Package is in development. APIs may change in the future._
88

99
You can try the example app demo on this link: https://gluestack-flutter.web.app/
1010

11-
We are referring gluestack-ui to create gluestack-ui-flutter. Flutter documantation is in progress. You can find detailed documentation for each component, including a list of props and examples, in https://gluestack.io/ui/docs website.
11+
We are referring gluestack-ui to create gluestack-ui-flutter. Flutter documentation is in progress. You can find the detailed documentation for each component, including a list of props and examples, in https://gluestack.io/ui/docs website.
1212

1313
## Features
1414

@@ -30,7 +30,7 @@ Add the package to your dependencies:
3030

3131
```yaml
3232
dependencies:
33-
gluestack_ui: 0.0.1-alpha.1
33+
gluestack_ui: 0.0.1-alpha.2
3434
```
3535
3636
OR
@@ -71,6 +71,8 @@ GSButton(
7171
)
7272
```
7373

74+
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.
75+
7476
## Contributing
7577

7678
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/lib/example/KitchenSink/components/header.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import 'package:flutter/material.dart';
22
import 'package:gluestack_ui/gluestack_ui.dart';
33

44
class KSHeader extends StatelessWidget {
5-
final Function themeCallback;
6-
final ThemeProvider themeProvider;
7-
const KSHeader(
8-
{super.key, required this.themeCallback, required this.themeProvider});
5+
final VoidCallback themeCallback;
6+
7+
const KSHeader({super.key, required this.themeCallback});
98

109
@override
1110
Widget build(BuildContext context) {
@@ -70,7 +69,7 @@ class KSHeader extends StatelessWidget {
7069
child: GSIcon(
7170
size: GSSizes.$xl,
7271
icon:
73-
themeProvider.currentTheme == GSThemeMode.light
72+
Theme.of(context).brightness == Brightness.light
7473
? Icons.nightlight_rounded
7574
: Icons.light_mode,
7675
style: GSStyle(

example/lib/example/KitchenSink/components/list_your_place_modal/modal.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import 'package:gluestack_ui_example/example/KitchenSink/components/list_your_pl
44
import 'package:gluestack_ui_example/example/KitchenSink/components/list_your_place_modal/content2.dart';
55
import 'package:gluestack_ui_example/example/KitchenSink/components/list_your_place_modal/content3.dart';
66

7-
import 'package:provider/provider.dart';
8-
97
class ListYourPlaceModal extends StatefulWidget {
108
const ListYourPlaceModal({super.key});
119

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
11
import 'package:flutter/material.dart';
22
import 'package:gluestack_ui/gluestack_ui.dart';
3-
import 'package:provider/provider.dart';
43

54
import 'components/banner.dart';
65
import 'components/header.dart';
76
import 'components/main_component.dart';
87
import 'components/sidebar/sidebar.dart';
98

109
class LayoutExample extends StatelessWidget {
11-
const LayoutExample({super.key});
10+
final VoidCallback toggleTheme;
11+
12+
const LayoutExample({super.key, required this.toggleTheme});
1213

1314
@override
1415
Widget build(BuildContext context) {
15-
return Consumer<ThemeProvider>(builder: (context, themeProvider, child) {
16-
return Scaffold(
17-
body: SafeArea(
18-
child: GSVStack(
19-
crossAxisAlignment: CrossAxisAlignment.stretch,
20-
children: [
21-
const KSBanner(),
22-
KSHeader(
23-
themeProvider: themeProvider,
24-
themeCallback: () {
25-
themeProvider.toggleTheme();
26-
},
27-
),
28-
Expanded(
29-
child: GSBox(
30-
style: GSStyle(
31-
padding: const EdgeInsets.symmetric(
32-
horizontal: 30, vertical: 21),
33-
),
34-
child: const GSHStack(
35-
crossAxisAlignment: CrossAxisAlignment.stretch,
36-
mainAxisAlignment: MainAxisAlignment.center,
37-
children: [
38-
Flexible(
39-
flex: 1,
40-
child: Padding(
41-
padding: EdgeInsets.only(right: 30),
42-
child: SingleChildScrollView(
43-
child: KSSideBar(),
44-
),
45-
),
46-
),
47-
Flexible(
48-
flex: 3,
16+
return Scaffold(
17+
body: SafeArea(
18+
child: GSVStack(
19+
crossAxisAlignment: CrossAxisAlignment.stretch,
20+
children: [
21+
const KSBanner(),
22+
KSHeader(
23+
themeCallback: toggleTheme,
24+
),
25+
Expanded(
26+
child: GSBox(
27+
style: GSStyle(
28+
padding:
29+
const EdgeInsets.symmetric(horizontal: 30, vertical: 21),
30+
),
31+
child: const GSHStack(
32+
crossAxisAlignment: CrossAxisAlignment.stretch,
33+
mainAxisAlignment: MainAxisAlignment.center,
34+
children: [
35+
Flexible(
36+
flex: 1,
37+
child: Padding(
38+
padding: EdgeInsets.only(right: 30),
4939
child: SingleChildScrollView(
50-
child: KSMainComponent(),
40+
child: KSSideBar(),
5141
),
5242
),
53-
],
54-
),
43+
),
44+
Flexible(
45+
flex: 3,
46+
child: SingleChildScrollView(
47+
child: KSMainComponent(),
48+
),
49+
),
50+
],
5551
),
5652
),
57-
],
58-
),
53+
),
54+
],
5955
),
60-
);
61-
});
56+
),
57+
);
6258
}
6359
}

example/lib/example/alert_example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class AlertExample extends StatelessWidget {
3636
)
3737
''';
3838
return Scaffold(
39-
appBar: AppBar(),
39+
appBar: AppBar(
40+
title: const Text("Alert"),
41+
),
4042
body: BaseLayout(
4143
code: code,
4244
component: Center(

example/lib/example/avatar_example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ class _AvatarExampleState extends State<AvatarExample> {
5959
)
6060
''';
6161
return Scaffold(
62-
appBar: AppBar(),
62+
appBar: AppBar(
63+
title: const Text("Avatar"),
64+
),
6365
body: BaseLayout(
6466
code: code,
6567
component: GSAvatar(

example/lib/example/badge_example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ class _BadgeExampleState extends State<BadgeExample> {
8282
)
8383
''';
8484
return Scaffold(
85-
appBar: AppBar(),
85+
appBar: AppBar(
86+
title: const Text("Badge"),
87+
),
8688
body: BaseLayout(
8789
code: code,
8890
component: GSBadge(

example/lib/example/button_example.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ class _ButtonExampleState extends State<ButtonExample> {
8686
)
8787
''';
8888
return Scaffold(
89-
appBar: AppBar(),
89+
appBar: AppBar(
90+
title: const Text("Button"),
91+
),
9092
body: BaseLayout(
9193
code: code,
9294
component: GSButton(
@@ -95,6 +97,11 @@ class _ButtonExampleState extends State<ButtonExample> {
9597
size: selectedSizeOption,
9698
isDisabled: isDisabled,
9799
isFocusVisible: isFocusVisible,
100+
style: GSStyle(
101+
dark: GSStyle(
102+
bg: $GSColors.red400,
103+
),
104+
),
98105
onPressed: () {},
99106
child: const Row(
100107
children: [

example/lib/example/center_example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class CenterExample extends StatelessWidget {
1919
)
2020
''';
2121
return Scaffold(
22-
appBar: AppBar(),
22+
appBar: AppBar(
23+
title: const Text("Center"),
24+
),
2325
body: BaseLayout(
2426
code: code,
2527
component: GSCenter(

0 commit comments

Comments
 (0)