Skip to content

Commit

Permalink
0.3.0 Part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MahanRahmati committed Mar 6, 2022
1 parent ccc00e5 commit 57ab88a
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 40 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- [Example] Update main page
- Update ArnaSideScaffold
- Refactor ArnaSideBarItem
- Fixing sidebar item color [Thanks to @h1376h]
- Fixing borderless colored button [Thanks to @h1376h]
- Update ArnaDrawer
- Update ArnaPopupDialog

## 0.2.9

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This Framework is in active development. Any contribution, idea, criticism or fe
<img src="https://img.shields.io/github/license/MahanRahmati/arna">
</p>

<img alt="Light" src="https://user-images.githubusercontent.com/16052180/156883237-4acd58f2-fad2-47a4-82c5-4e8ea0e54244.png">
<img alt="Dark" src="https://user-images.githubusercontent.com/16052180/156883228-684fec2c-b93f-4eec-a9e0-8e166417736f.png">
<img alt="Light" src="https://user-images.githubusercontent.com/16052180/156903704-0b04c8b9-f560-4f03-a185-139aab1b2c09.png">
<img alt="Dark" src="https://user-images.githubusercontent.com/16052180/156903698-94a516a0-696e-4cb8-8cb9-c4025d7352b9.png">

## Content

Expand Down Expand Up @@ -62,7 +62,7 @@ Add Arna as a dependency in your pubspec.yaml

```yaml
dependencies:
arna: ^0.2.9
arna: ^0.3.0
```
And import it
Expand Down Expand Up @@ -515,7 +515,6 @@ ArnaBanner(
## TODO

- Dropdown Button
- Popup Button
- Date and Time Pickers
- Chip

Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class _HomeState extends ConsumerState<Home> {
)
: ArnaSideScaffold(
title: "Arna Demo",
icon: Container(decoration: const FlutterLogoDecoration()),
headerBarTrailing: Row(
children: [
ArnaIconButton(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/base/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ArnaDrawer extends StatelessWidget {
curve: Styles.basicCurve,
clipBehavior: Clip.antiAlias,
color: ArnaDynamicColor.resolve(
ArnaColors.backgroundColor,
ArnaColors.sideColor,
context,
),
child: child,
Expand Down Expand Up @@ -123,11 +123,11 @@ class _ArnaDrawerControllerState extends State<ArnaDrawerController>
void initState() {
super.initState();
_controller = AnimationController(
value: widget.isDrawerOpen ? 1.0 : 0.0,
duration: Styles.basicDuration,
vsync: this,
);
_controller.addListener(_animationChanged);
if (widget.isDrawerOpen) open();
}

@override
Expand All @@ -143,7 +143,7 @@ class _ArnaDrawerControllerState extends State<ArnaDrawerController>
switch (_controller.status) {
case AnimationStatus.completed:
case AnimationStatus.dismissed:
_controller.value = widget.isDrawerOpen ? 1.0 : 0.0;
widget.isDrawerOpen ? open() : close();
break;
case AnimationStatus.forward:
case AnimationStatus.reverse:
Expand Down
33 changes: 12 additions & 21 deletions lib/src/base/side_bar_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,18 @@ class ArnaSideBarItem extends StatelessWidget {
context,
),
),
color: !enabled
? ArnaDynamicColor.resolve(
ArnaColors.backgroundColor,
context,
)
: pressed
? ArnaDynamicColor.resolve(
ArnaColors.buttonPressedColor,
context,
)
: selected
? ArnaDynamicColor.resolve(
ArnaColors.buttonColor,
context,
)
: hover
? ArnaDynamicColor.resolve(
ArnaColors.buttonHoverColor,
context,
)
: ArnaColors.color00,
color: ArnaDynamicColor.resolve(
!enabled
? ArnaColors.backgroundColor
: pressed
? ArnaColors.buttonPressedColor
: hover
? ArnaColors.buttonHoverColor
: selected
? ArnaColors.buttonColor
: ArnaColors.sideColor,
context,
),
),
padding: Styles.horizontal,
child: _buildChild(context, enabled, selected, accent),
Expand Down
26 changes: 17 additions & 9 deletions lib/src/base/side_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ArnaSideScaffold extends StatefulWidget {
this.headerBarLeading,
this.title,
this.headerBarTrailing,
this.icon,
required this.items,
this.onItemSelected,
this.currentIndex = 0,
Expand All @@ -25,6 +26,9 @@ class ArnaSideScaffold extends StatefulWidget {
/// The trailing widget laid out within the header bar.
final Widget? headerBarTrailing;

/// The icon widget laid out within the side bar.
final Widget? icon;

/// The list of navigation items.
final List<NavigationItem> items;

Expand Down Expand Up @@ -63,6 +67,7 @@ class _ArnaSideScaffoldState extends State<ArnaSideScaffold>
void onTap(int index) {
showDrawer = false;
if (widget.onItemSelected != null) widget.onItemSelected!(index);
_drawerOpenedCallback(false);
setState(() => _currentIndex = index);
_controller.value = 0;
_controller.forward().then((value) => null);
Expand All @@ -75,15 +80,19 @@ class _ArnaSideScaffoldState extends State<ArnaSideScaffold>
Widget _buildChild() {
return Column(
children: [
SizedBox(
height: Styles.sideBarIconHeight,
child: Container(
width: Styles.sideBarItemHeight,
decoration: const FlutterLogoDecoration(),
if (widget.icon != null)
SizedBox(
height: Styles.sideBarIconHeight,
child: SizedBox(
height: Styles.sideBarItemHeight,
width: Styles.sideBarItemHeight,
child: widget.icon,
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height - Styles.sideBarIconHeight,
height: widget.icon != null
? MediaQuery.of(context).size.height - Styles.sideBarIconHeight
: MediaQuery.of(context).size.height,
child: ListView.builder(
controller: ScrollController(),
itemCount: widget.items.length,
Expand Down Expand Up @@ -145,8 +154,7 @@ class _ArnaSideScaffoldState extends State<ArnaSideScaffold>
if (constraints.maxWidth < 644)
ArnaIconButton(
icon: Icons.menu_outlined,
onPressed: () =>
_drawerOpenedCallback(!showDrawer),
onPressed: () => _drawerOpenedCallback(true),
),
if (widget.headerBarLeading != null)
widget.headerBarLeading!,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/dialogs/popup_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class _ArnaPopupDialog extends StatelessWidget {
context: context,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: deviceHeight(context) * 0.77,
maxWidth: deviceWidth(context) * 0.77,
maxHeight: deviceHeight(context) * 0.84,
maxWidth: deviceWidth(context) * 0.84,
),
child: AnimatedContainer(
duration: Styles.basicDuration,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: arna
description: Arna Framework - A unique set of widgets for building applications with Flutter.
version: 0.2.9
version: 0.3.0
homepage: https://github.com/MahanRahmati/Arna

environment:
Expand Down

0 comments on commit 57ab88a

Please sign in to comment.