Skip to content

Commit

Permalink
update validation and version
Browse files Browse the repository at this point in the history
  • Loading branch information
shiburagi committed Mar 10, 2021
1 parent f8dd7a2 commit 955cece
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.1.0
* Prefix and suffix attribute

# 2.0.0+4
* Change minimum version for dart

Expand Down
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,24 @@ new DrawerScaffold(
```dart
new DrawerScaffold(
headerView: headerView(context),
itemBuilder:
(BuildContext context, MenuItem menuItem, bool isSelected) {
return Container(
color: isSelected
? Theme.of(context).accentColor.withOpacity(0.7)
: Colors.transparent,
padding: EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Text(
menuItem.title,
style: Theme.of(context).textTheme.subhead?.copyWith(
color: isSelected ? Colors.black87 : Colors.white70),
),
);
}
drawers: [
SideDrawer(
itemBuilder:
(BuildContext context, MenuItem menuItem, bool isSelected) {
return Container(
color: isSelected
? Theme.of(context).accentColor.withOpacity(0.7)
: Colors.transparent,
padding: EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Text(
menuItem.title,
style: Theme.of(context).textTheme.subhead?.copyWith(
color: isSelected ? Colors.black87 : Colors.white70),
),
);
}
)
],
...
);
```
Expand Down
12 changes: 11 additions & 1 deletion lib/menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,20 @@ class Menu {
class MenuItem<T> {
final T? id;
final String title;

/// set icon from [MenuItem], if the icon is not null, the prefix must be null
final IconData? icon;

/// set prefix widget from [MenuItem], if the prefix is not null, the icon must be null
final Widget? prefix;

/// set prefix widget from [MenuItem]
final Widget? suffix;

/// set independent text style for title
final TextStyle? textStyle;

/// append data with [MenuItem], then can be use on itemBuilder
final dynamic data;

MenuItem({
Expand All @@ -651,7 +661,7 @@ class MenuItem<T> {
this.suffix,
this.textStyle,
this.data,
}) : assert(prefix != null && icon != null);
}) : assert(prefix == null || icon == null);

MenuItem<T> copyWith({
T? id,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 2.1.0
homepage: https://github.com/shiburagi/Drawer-Behavior-Flutter

environment:
sdk: '>=2.12.0-259.9.beta <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down

0 comments on commit 955cece

Please sign in to comment.