-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from SaltyAom/feat/aegleseeker
feat: 2.2 (Aegleseeker)
- Loading branch information
Showing
61 changed files
with
1,720 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
Oops, something went wrong.