Skip to content

Commit 8ee7833

Browse files
authored
Merge pull request #23 from SaltyAom/feat/aegleseeker
feat: 2.2 (Aegleseeker)
2 parents 6031f0d + 6bc63bf commit 8ee7833

Some content is hidden

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

61 files changed

+1720
-370
lines changed

CHANGELOG.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,152 @@
1+
# [2.2.0] - 2022/03/18
2+
Improvement:
3+
- Reduce Time Complexity of hooks from `UseQueryMacro` from O(n(2i + p)) to O(n) where n is property, p is parent total callstack, and i is total invocation.
4+
By passing widget self as reference instead of immutable copied then diffing, and apply
5+
The following hooks benefits in performance improvement:
6+
- useQuery
7+
- useSize
8+
- useDarkMode
9+
- useThemeSelector
10+
- useScreen
11+
12+
Feature:
13+
- New parent proxy available for all widget:
14+
- expanded
15+
- flex
16+
- fullSize
17+
- fullWidth, wFull, w100
18+
- fullHeight, hFull, h100
19+
- fractionSize, sizePercent
20+
- fractionWidth, fractionW, fw, wFactor, widthPercent, wPercent
21+
- fractionHeight, fractionH, hw, hFactor, heightPercent, hPercent
22+
- boxConstraints
23+
- nikuConstraints
24+
- maxSize
25+
- minSize
26+
- maxWidth, maxW, wMax
27+
- minWidth, minW, wMin
28+
- maxHeight, maxH, hMax
29+
- minHeight, minH, hMin
30+
- width, w
31+
- height, h
32+
- useGesture
33+
- New parent proxy available for AxisLayourProxy
34+
- alignTopLeft
35+
- alignTopCenter
36+
- alignTopRight
37+
- alignCenterLeft
38+
- alignCenter
39+
- alignCenterRight
40+
- alignBottomLeft
41+
- alignBottomCenter
42+
- alignBottomRight
43+
- New widget: `NikuRadio`, `NikuRadioListTile`, `NikuDismissible`
44+
- New hook: `useTransition`, `useTransitions`
45+
- Add property: `splash`, `wFactor`, `hFactor` to `Niku`
46+
- New utility widget `NikuAnimated`, `NikuAnimateds`
47+
- New proxy: `ListTile` with `dismiss` for `NikuDismissible`
48+
49+
Change:
50+
- Move part of `AxisProxy` to `NikuBuildMacro`
51+
- Refactor, and organize examples
52+
53+
Bug fixes:
54+
- `obscureCharacter` not working in `NikuTextFormField`
55+
56+
57+
# [2.2.0-experimental.1] - 2022/03/17
58+
Improvement:
59+
- Reduce Time Complexity of hooks from `UseQueryMacro` from O(n(2i + p)) to O(n) where n is property, p is parent total callstack, and i is total invocation.
60+
By passing widget self as reference instead of immutable copied then diffing, and apply
61+
The following hooks benefits in performance improvement:
62+
- useQuery
63+
- useSize
64+
- useDarkMode
65+
- useThemeSelector
66+
- useScreen
67+
68+
Feature:
69+
- New parent proxy available for all widget:
70+
- expanded
71+
- flex
72+
- fullSize
73+
- fullWidth, wFull, w100
74+
- fullHeight, hFull, h100
75+
- fractionSize, sizePercent
76+
- fractionWidth, fractionW, fw, wFactor, widthPercent, wPercent
77+
- fractionHeight, fractionH, hw, hFactor, heightPercent, hPercent
78+
- boxConstraints
79+
- nikuConstraints
80+
- maxSize
81+
- minSize
82+
- maxWidth, maxW, wMax
83+
- minWidth, minW, wMin
84+
- maxHeight, maxH, hMax
85+
- minHeight, minH, hMin
86+
- width, w
87+
- height, h
88+
- useGesture
89+
- New parent proxy available for AxisLayourProxy
90+
- alignTopLeft
91+
- alignTopCenter
92+
- alignTopRight
93+
- alignCenterLeft
94+
- alignCenter
95+
- alignCenterRight
96+
- alignBottomLeft
97+
- alignBottomCenter
98+
- alignBottomRight
99+
100+
Change:
101+
- Move part of `AxisProxy` to `NikuBuildMacro`
102+
- Refactor, and organize examples
103+
104+
Bug fixes:
105+
- `obscureCharacter` not working in `NikuTextFormField`
106+
107+
# [2.2.0-experimental.0] - 2022/03/14
108+
Feature:
109+
- New widget: `NikuRadio`, `NikuRadioListTile`, `NikuDismissible`
110+
- New hook: `useTransition`, `useTransitions`
111+
- Add property: `splash`, `wFactor`, `hFactor` to `Niku`
112+
- New utility widget `NikuAnimated`, `NikuAnimateds`
113+
- New proxy: `ListTile` with `dismiss` for `NikuDismissible`
114+
1115
# [2.1.1] - 2022/03/10
2116
Bug fix:
3117
- Unmatch filename with capital case
4118
- Remove `print` from `PaddingMacro`
5119

120+
# [2.1.0] - 2022/02/28
121+
Breaking Change:
122+
- `flexible` is now `flex`
123+
- Deprecated required value of `TextFormField` in favor of `hint`.
124+
- To migrate, please add factory `.hint` or add it as `named parameter`
125+
126+
127+
Feature:
128+
- Add mandatory shortcut to `AxisLayoutProxy`
129+
- Add `useThemeSelector` for declarative `useDarkMode`
130+
- Support all factory method for `NikuGridView`
131+
- Add `NikuListView`
132+
- Add `AxisLayoutMacro`
133+
- Add `.center`, `.w100`, `safeArea` to `AxisLayoutMacro`
134+
- Add `of` alias for `apply`
135+
136+
Change:
137+
- `AxisLayoutMacro` is now `AxisLayoutProxy`
138+
- `borderWidth` is now `baseBorderWidth` to follow the same convention with `border`, `borderColor`, and `borderStyle` on proxy
139+
- Remove function allocation from `_init` of `MapTextStyleMacro`
140+
- Add `center` to `NikuColumn`, and `NikuRow`
141+
- Replace `childrenWithGap` with `$internalComposeGap` in `GapMacro`
142+
- Add `gap` property to AxisLayout
143+
- gap can now be applied
144+
- `childrenWithGap` now only composed on build
145+
146+
Bug fix:
147+
- `useDarkMode` and `useThemeSelector` not switching context between
148+
- Fix `'owner!._debugCurrentBuildTarget == this': is not true.` when using `useDarkMode`
149+
6150
# [2.1.0-experimental.4] - 2022/02/28
7151
Breaking Change:
8152
- `flexible` is now `flex`

example/lib/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Niku Example
2+
Every file is short, encapsulated, and self-explanatory.
3+
The example is following Niku best-practice which written by the maintainer by intent to demonstrate the use from simple to complicated thing.
4+
5+
Simply pick a file title which interested you.
6+

example/lib/alert.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import 'package:flutter/material.dart';
2+
3+
import 'package:niku/namespace.dart' as n;
4+
5+
// Adaptive Alert
6+
class AlertPage extends StatelessWidget {
7+
const AlertPage({Key? key}) : super(key: key);
8+
9+
build(context) {
10+
final showDialog = () {
11+
n.showDialog(
12+
context: context,
13+
barrierDismissible: true,
14+
builder: (context) => n.Alert.adaptive()
15+
..title = Text("Hello World")
16+
..content = n.NikuColumn([
17+
Text("This is alert dialog written in Niku"),
18+
n.TextFormField.adaptive()
19+
..label = "Placeholder"
20+
..mt = 16,
21+
])
22+
..actions = [
23+
n.Button(Text("Delete"))
24+
..onPressed = () {
25+
Navigator.of(context).pop();
26+
}
27+
..color = Colors.red
28+
..splash = Colors.red.withOpacity(.15),
29+
n.Button(Text("Cancel"))
30+
..onPressed = () {
31+
Navigator.of(context).pop();
32+
}
33+
..bold,
34+
],
35+
);
36+
};
37+
38+
return Scaffold(
39+
body: n.Button(n.Text("Show Alert"))
40+
..onPressed = showDialog
41+
..fontSize = 18
42+
..w500
43+
..color = Colors.white
44+
..px = 24
45+
..py = 12
46+
..splash = Colors.white.withOpacity(.25)
47+
..bg = Colors.transparent
48+
..useParent((v) => v
49+
..gradient = LinearGradient(
50+
colors: [Color(0xff4A00E0), Color(0xff8E2DE2)],
51+
)
52+
..rounded = 8
53+
..center),
54+
);
55+
}
56+
}

example/lib/card.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'package:flutter/material.dart';
2+
3+
import 'package:niku/namespace.dart' as n;
4+
5+
class CardPage extends StatelessWidget {
6+
const CardPage({Key? key}) : super(key: key);
7+
8+
build(context) {
9+
return Scaffold(
10+
body: Icon(Icons.home_outlined, color: Colors.white).niku
11+
..p = 10
12+
..bg = Color(0xff7AC1E7)
13+
..rounded
14+
..p = 15
15+
..bg = Color(0xffE8F2F7)
16+
..rounded
17+
..p = 20
18+
..useChild(
19+
(child) => Card(
20+
elevation: 10,
21+
child: child,
22+
shape: RoundedRectangleBorder(
23+
borderRadius: BorderRadius.circular(20),
24+
),
25+
),
26+
)
27+
..center,
28+
);
29+
}
30+
}

example/lib/counter.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_hooks/flutter_hooks.dart';
3+
4+
import 'package:niku/namespace.dart' as n;
5+
6+
class CounterStyles {
7+
static button(Color color) => n.Button(SizedBox.shrink())
8+
..rounded = 4
9+
..px = 24
10+
..py = 12
11+
..fontSize = 18
12+
..w500
13+
..color = color;
14+
}
15+
16+
class Counter extends HookWidget {
17+
const Counter();
18+
19+
build(context) {
20+
final count = useState(0);
21+
22+
return Scaffold(
23+
body: n.Column([
24+
n.Text(count.value.toString())
25+
..center
26+
..h4 = context,
27+
n.Column([
28+
n.Button(n.Text("Increment"))
29+
..onPressed = () {
30+
count.value++;
31+
}
32+
..apply = CounterStyles.button(Colors.blue.shade700)
33+
..bg = Colors.blue.shade50
34+
..splash = Colors.blue.shade100,
35+
n.Button(n.Text("Decrement"))
36+
..onPressed = () {
37+
count.value--;
38+
}
39+
..apply = CounterStyles.button(Colors.red.shade700)
40+
..bg = Colors.red.shade50
41+
..splash = Colors.red.shade100,
42+
])
43+
..gap = 4
44+
..freezed,
45+
])
46+
..center
47+
..gap = 16
48+
..alignCenter,
49+
);
50+
}
51+
}

example/lib/derived_style.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import 'package:flutter/material.dart';
2+
3+
import 'package:niku/namespace.dart' as n;
4+
5+
class DerivedStyles {
6+
static final title = n.Text("")
7+
..fontSize = 24
8+
..color = Colors.blue
9+
..useParent((v) => v
10+
..p = 12
11+
..bg = Colors.blue.shade50);
12+
13+
static final rounded = n.Text("")
14+
..w500
15+
..useParent((v) => v
16+
..bg = Colors.blue.shade50
17+
..rounded = 8);
18+
19+
static final roundedTitle = DerivedStyles.title.copied..apply = rounded;
20+
21+
static final centerCol = n.Column([])
22+
..center
23+
..w100;
24+
}
25+
26+
class DerivedStylesPage extends StatelessWidget {
27+
@override
28+
build(context) {
29+
return Scaffold(
30+
body: n.Column([
31+
n.Text("Hello Niku")..apply = DerivedStyles.roundedTitle,
32+
])
33+
..apply = DerivedStyles.centerCol,
34+
);
35+
}
36+
}

example/lib/example.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export 'alert.dart';
2+
export 'card.dart';
3+
export 'counter.dart';
4+
export 'derived_style.dart';
5+
export 'general.dart';
6+
export 'japan_native.dart';
7+
export 'japan.dart';
8+
export 'music.dart';
9+
export 'progress.dart';
10+
11+
export 'version/2.1/g11.dart';
12+
export 'version/2.2/aegle.dart';

0 commit comments

Comments
 (0)