Skip to content

Commit

Permalink
Merge pull request #23 from SaltyAom/feat/aegleseeker
Browse files Browse the repository at this point in the history
feat: 2.2 (Aegleseeker)
  • Loading branch information
SaltyAom committed Mar 18, 2022
2 parents 6031f0d + 6bc63bf commit 8ee7833
Show file tree
Hide file tree
Showing 61 changed files with 1,720 additions and 370 deletions.
144 changes: 144 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,152 @@
# [2.2.0] - 2022/03/18
Improvement:
- 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.
By passing widget self as reference instead of immutable copied then diffing, and apply
The following hooks benefits in performance improvement:
- useQuery
- useSize
- useDarkMode
- useThemeSelector
- useScreen

Feature:
- New parent proxy available for all widget:
- expanded
- flex
- fullSize
- fullWidth, wFull, w100
- fullHeight, hFull, h100
- fractionSize, sizePercent
- fractionWidth, fractionW, fw, wFactor, widthPercent, wPercent
- fractionHeight, fractionH, hw, hFactor, heightPercent, hPercent
- boxConstraints
- nikuConstraints
- maxSize
- minSize
- maxWidth, maxW, wMax
- minWidth, minW, wMin
- maxHeight, maxH, hMax
- minHeight, minH, hMin
- width, w
- height, h
- useGesture
- New parent proxy available for AxisLayourProxy
- alignTopLeft
- alignTopCenter
- alignTopRight
- alignCenterLeft
- alignCenter
- alignCenterRight
- alignBottomLeft
- alignBottomCenter
- alignBottomRight
- New widget: `NikuRadio`, `NikuRadioListTile`, `NikuDismissible`
- New hook: `useTransition`, `useTransitions`
- Add property: `splash`, `wFactor`, `hFactor` to `Niku`
- New utility widget `NikuAnimated`, `NikuAnimateds`
- New proxy: `ListTile` with `dismiss` for `NikuDismissible`

Change:
- Move part of `AxisProxy` to `NikuBuildMacro`
- Refactor, and organize examples

Bug fixes:
- `obscureCharacter` not working in `NikuTextFormField`


# [2.2.0-experimental.1] - 2022/03/17
Improvement:
- 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.
By passing widget self as reference instead of immutable copied then diffing, and apply
The following hooks benefits in performance improvement:
- useQuery
- useSize
- useDarkMode
- useThemeSelector
- useScreen

Feature:
- New parent proxy available for all widget:
- expanded
- flex
- fullSize
- fullWidth, wFull, w100
- fullHeight, hFull, h100
- fractionSize, sizePercent
- fractionWidth, fractionW, fw, wFactor, widthPercent, wPercent
- fractionHeight, fractionH, hw, hFactor, heightPercent, hPercent
- boxConstraints
- nikuConstraints
- maxSize
- minSize
- maxWidth, maxW, wMax
- minWidth, minW, wMin
- maxHeight, maxH, hMax
- minHeight, minH, hMin
- width, w
- height, h
- useGesture
- New parent proxy available for AxisLayourProxy
- alignTopLeft
- alignTopCenter
- alignTopRight
- alignCenterLeft
- alignCenter
- alignCenterRight
- alignBottomLeft
- alignBottomCenter
- alignBottomRight

Change:
- Move part of `AxisProxy` to `NikuBuildMacro`
- Refactor, and organize examples

Bug fixes:
- `obscureCharacter` not working in `NikuTextFormField`

# [2.2.0-experimental.0] - 2022/03/14
Feature:
- New widget: `NikuRadio`, `NikuRadioListTile`, `NikuDismissible`
- New hook: `useTransition`, `useTransitions`
- Add property: `splash`, `wFactor`, `hFactor` to `Niku`
- New utility widget `NikuAnimated`, `NikuAnimateds`
- New proxy: `ListTile` with `dismiss` for `NikuDismissible`

# [2.1.1] - 2022/03/10
Bug fix:
- Unmatch filename with capital case
- Remove `print` from `PaddingMacro`

# [2.1.0] - 2022/02/28
Breaking Change:
- `flexible` is now `flex`
- Deprecated required value of `TextFormField` in favor of `hint`.
- To migrate, please add factory `.hint` or add it as `named parameter`


Feature:
- Add mandatory shortcut to `AxisLayoutProxy`
- Add `useThemeSelector` for declarative `useDarkMode`
- Support all factory method for `NikuGridView`
- Add `NikuListView`
- Add `AxisLayoutMacro`
- Add `.center`, `.w100`, `safeArea` to `AxisLayoutMacro`
- Add `of` alias for `apply`

Change:
- `AxisLayoutMacro` is now `AxisLayoutProxy`
- `borderWidth` is now `baseBorderWidth` to follow the same convention with `border`, `borderColor`, and `borderStyle` on proxy
- Remove function allocation from `_init` of `MapTextStyleMacro`
- Add `center` to `NikuColumn`, and `NikuRow`
- Replace `childrenWithGap` with `$internalComposeGap` in `GapMacro`
- Add `gap` property to AxisLayout
- gap can now be applied
- `childrenWithGap` now only composed on build

Bug fix:
- `useDarkMode` and `useThemeSelector` not switching context between
- Fix `'owner!._debugCurrentBuildTarget == this': is not true.` when using `useDarkMode`

# [2.1.0-experimental.4] - 2022/02/28
Breaking Change:
- `flexible` is now `flex`
Expand Down
6 changes: 6 additions & 0 deletions example/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Niku Example
Every file is short, encapsulated, and self-explanatory.
The example is following Niku best-practice which written by the maintainer by intent to demonstrate the use from simple to complicated thing.

Simply pick a file title which interested you.

56 changes: 56 additions & 0 deletions example/lib/alert.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';

import 'package:niku/namespace.dart' as n;

// Adaptive Alert
class AlertPage extends StatelessWidget {
const AlertPage({Key? key}) : super(key: key);

build(context) {
final showDialog = () {
n.showDialog(
context: context,
barrierDismissible: true,
builder: (context) => n.Alert.adaptive()
..title = Text("Hello World")
..content = n.NikuColumn([
Text("This is alert dialog written in Niku"),
n.TextFormField.adaptive()
..label = "Placeholder"
..mt = 16,
])
..actions = [
n.Button(Text("Delete"))
..onPressed = () {
Navigator.of(context).pop();
}
..color = Colors.red
..splash = Colors.red.withOpacity(.15),
n.Button(Text("Cancel"))
..onPressed = () {
Navigator.of(context).pop();
}
..bold,
],
);
};

return Scaffold(
body: n.Button(n.Text("Show Alert"))
..onPressed = showDialog
..fontSize = 18
..w500
..color = Colors.white
..px = 24
..py = 12
..splash = Colors.white.withOpacity(.25)
..bg = Colors.transparent
..useParent((v) => v
..gradient = LinearGradient(
colors: [Color(0xff4A00E0), Color(0xff8E2DE2)],
)
..rounded = 8
..center),
);
}
}
30 changes: 30 additions & 0 deletions example/lib/card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';

import 'package:niku/namespace.dart' as n;

class CardPage extends StatelessWidget {
const CardPage({Key? key}) : super(key: key);

build(context) {
return Scaffold(
body: Icon(Icons.home_outlined, color: Colors.white).niku
..p = 10
..bg = Color(0xff7AC1E7)
..rounded
..p = 15
..bg = Color(0xffE8F2F7)
..rounded
..p = 20
..useChild(
(child) => Card(
elevation: 10,
child: child,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
)
..center,
);
}
}
51 changes: 51 additions & 0 deletions example/lib/counter.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

import 'package:niku/namespace.dart' as n;

class CounterStyles {
static button(Color color) => n.Button(SizedBox.shrink())
..rounded = 4
..px = 24
..py = 12
..fontSize = 18
..w500
..color = color;
}

class Counter extends HookWidget {
const Counter();

build(context) {
final count = useState(0);

return Scaffold(
body: n.Column([
n.Text(count.value.toString())
..center
..h4 = context,
n.Column([
n.Button(n.Text("Increment"))
..onPressed = () {
count.value++;
}
..apply = CounterStyles.button(Colors.blue.shade700)
..bg = Colors.blue.shade50
..splash = Colors.blue.shade100,
n.Button(n.Text("Decrement"))
..onPressed = () {
count.value--;
}
..apply = CounterStyles.button(Colors.red.shade700)
..bg = Colors.red.shade50
..splash = Colors.red.shade100,
])
..gap = 4
..freezed,
])
..center
..gap = 16
..alignCenter,
);
}
}
36 changes: 36 additions & 0 deletions example/lib/derived_style.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';

import 'package:niku/namespace.dart' as n;

class DerivedStyles {
static final title = n.Text("")
..fontSize = 24
..color = Colors.blue
..useParent((v) => v
..p = 12
..bg = Colors.blue.shade50);

static final rounded = n.Text("")
..w500
..useParent((v) => v
..bg = Colors.blue.shade50
..rounded = 8);

static final roundedTitle = DerivedStyles.title.copied..apply = rounded;

static final centerCol = n.Column([])
..center
..w100;
}

class DerivedStylesPage extends StatelessWidget {
@override
build(context) {
return Scaffold(
body: n.Column([
n.Text("Hello Niku")..apply = DerivedStyles.roundedTitle,
])
..apply = DerivedStyles.centerCol,
);
}
}
12 changes: 12 additions & 0 deletions example/lib/example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export 'alert.dart';
export 'card.dart';
export 'counter.dart';
export 'derived_style.dart';
export 'general.dart';
export 'japan_native.dart';
export 'japan.dart';
export 'music.dart';
export 'progress.dart';

export 'version/2.1/g11.dart';
export 'version/2.2/aegle.dart';

0 comments on commit 8ee7833

Please sign in to comment.