Skip to content

[flutter_adaptive_scaffold] : 🐛 [FIX] : Issue: 121135. #3253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8397d92
[flutter_adaptive_scaffold] : 🐛 [FIX] : Issue: 121135.
aliasgar4558 Feb 22, 2023
a066163
✅ : Test case updated.
aliasgar4558 Feb 22, 2023
9817fca
📝 : README.md updated for /example.
aliasgar4558 Feb 22, 2023
e2d6ee3
📝 : README.md file updated with the help of tool.
aliasgar4558 Feb 22, 2023
43adf69
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 23, 2023
de2c14a
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 23, 2023
bb90b3c
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 23, 2023
20881f0
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 24, 2023
d2f28f2
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 25, 2023
bbb65ac
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 27, 2023
0427ef3
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 27, 2023
7f4cd28
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 28, 2023
257cac2
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Feb 28, 2023
2bb7c6a
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 1, 2023
41c12e1
💡 : PR comments resolved.
aliasgar4558 Mar 1, 2023
90eed41
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 1, 2023
e0327ae
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 3, 2023
800cfb1
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 3, 2023
f7c6f8a
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 4, 2023
2b6fe71
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 4, 2023
546aa34
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 5, 2023
5eb9525
⬆️ : Version upgraded to 0.1.2
aliasgar4558 Mar 5, 2023
2b42938
v0.1.1 updated.
aliasgar4558 Mar 5, 2023
fdb67da
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 8, 2023
5148a75
💡 : PR comments resolved..
aliasgar4558 Mar 8, 2023
bbbb7ae
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 10, 2023
82f05d6
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 10, 2023
40efe64
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 11, 2023
b4242bd
✅ : Test cases added for adaptive scaffold for determining display of…
aliasgar4558 Mar 11, 2023
bfda115
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 11, 2023
4ba9ac5
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 12, 2023
2087935
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 14, 2023
1215553
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 14, 2023
d2eb4f8
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 14, 2023
6a4969f
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 15, 2023
2f4825b
✅ : Test case updated.
aliasgar4558 Mar 15, 2023
ef76b42
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 16, 2023
743e0fb
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 16, 2023
2df840e
Merge branch 'main' into fix_121135_adaptive_scaffold
aliasgar4558 Mar 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/flutter_adaptive_scaffold/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## NEXT
## 0.1.1

* Fixes flutter/flutter#121135) `selectedIcon` parameter not displayed even if it is provided.

## 0.1.0+1

* Aligns Dart and Flutter SDK constraints.

Expand Down
111 changes: 73 additions & 38 deletions packages/flutter_adaptive_scaffold/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,60 @@ animation should use AdaptiveLayout.
)
];

return BottomNavigationBarTheme(
data: const BottomNavigationBarThemeData(
unselectedItemColor: Colors.black,
selectedItemColor: Colors.black,
backgroundColor: Colors.white,
return AdaptiveScaffold(
// An option to override the default breakpoints used for small, medium,
// and large.
smallBreakpoint: const WidthPlatformBreakpoint(end: 700),
mediumBreakpoint: const WidthPlatformBreakpoint(begin: 700, end: 1000),
largeBreakpoint: const WidthPlatformBreakpoint(begin: 1000),
useDrawer: false,
selectedIndex: _selectedTab,
onSelectedIndexChange: (int index) {
setState(() {
_selectedTab = index;
});
},
destinations: const <NavigationDestination>[
NavigationDestination(
icon: Icon(Icons.inbox_outlined),
selectedIcon: Icon(Icons.inbox),
label: 'Inbox',
),
child: AdaptiveScaffold(
// An option to override the default breakpoints used for small, medium,
// and large.
smallBreakpoint: const WidthPlatformBreakpoint(end: 700),
mediumBreakpoint:
const WidthPlatformBreakpoint(begin: 700, end: 1000),
largeBreakpoint: const WidthPlatformBreakpoint(begin: 1000),
useDrawer: false,
destinations: const <NavigationDestination>[
NavigationDestination(icon: Icon(Icons.inbox), label: 'Inbox'),
NavigationDestination(
icon: Icon(Icons.article), label: 'Articles'),
NavigationDestination(icon: Icon(Icons.chat), label: 'Chat'),
NavigationDestination(
icon: Icon(Icons.video_call), label: 'Video')
],
body: (_) => GridView.count(crossAxisCount: 2, children: children),
smallBody: (_) => ListView.builder(
itemCount: children.length,
itemBuilder: (_, int idx) => children[idx],
),
// Define a default secondaryBody.
secondaryBody: (_) =>
Container(color: const Color.fromARGB(255, 234, 158, 192)),
// Override the default secondaryBody during the smallBreakpoint to be
// empty. Must use AdaptiveScaffold.emptyBuilder to ensure it is properly
// overridden.
smallSecondaryBody: AdaptiveScaffold.emptyBuilder));
NavigationDestination(
icon: Icon(Icons.article_outlined),
selectedIcon: Icon(Icons.article),
label: 'Articles',
),
NavigationDestination(
icon: Icon(Icons.chat_outlined),
selectedIcon: Icon(Icons.chat),
label: 'Chat',
),
NavigationDestination(
icon: Icon(Icons.video_call_outlined),
selectedIcon: Icon(Icons.video_call),
label: 'Video',
),
NavigationDestination(
icon: Icon(Icons.home_outlined),
selectedIcon: Icon(Icons.home),
label: 'Inbox',
),
],
body: (_) => GridView.count(crossAxisCount: 2, children: children),
smallBody: (_) => ListView.builder(
itemCount: children.length,
itemBuilder: (_, int idx) => children[idx],
),
// Define a default secondaryBody.
secondaryBody: (_) => Container(
color: const Color.fromARGB(255, 234, 158, 192),
),
// Override the default secondaryBody during the smallBreakpoint to be
// empty. Must use AdaptiveScaffold.emptyBuilder to ensure it is properly
// overridden.
smallSecondaryBody: AdaptiveScaffold.emptyBuilder,
);
}
}
```
Expand Down Expand Up @@ -129,6 +149,12 @@ displayed and the entrance animation and exit animation.
inAnimation: AdaptiveScaffold.leftOutIn,
key: const Key('Primary Navigation Medium'),
builder: (_) => AdaptiveScaffold.standardNavigationRail(
selectedIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
leading: const Icon(Icons.menu),
destinations: destinations
.map((_) => AdaptiveScaffold.toRailDestination(_))
Expand All @@ -139,6 +165,12 @@ displayed and the entrance animation and exit animation.
key: const Key('Primary Navigation Large'),
inAnimation: AdaptiveScaffold.leftOutIn,
builder: (_) => AdaptiveScaffold.standardNavigationRail(
selectedIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
extended: true,
leading: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
Expand Down Expand Up @@ -184,11 +216,14 @@ displayed and the entrance animation and exit animation.
key: const Key('Bottom Navigation Small'),
inAnimation: AdaptiveScaffold.bottomToTop,
outAnimation: AdaptiveScaffold.topToBottom,
builder: (_) => BottomNavigationBarTheme(
data: const BottomNavigationBarThemeData(
selectedItemColor: Colors.black),
child: AdaptiveScaffold.standardBottomNavigationBar(
destinations: destinations),
builder: (_) => AdaptiveScaffold.standardBottomNavigationBar(
destinations: destinations,
currentIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ class MyApp extends StatelessWidget {

/// Creates a basic adaptive page with navigational elements and a body using
/// [AdaptiveLayout].
class MyHomePage extends StatelessWidget {
class MyHomePage extends StatefulWidget {
/// Creates a const [MyHomePage].
const MyHomePage({super.key});

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int selectedNavigation = 0;

@override
Widget build(BuildContext context) {
// Define the children to display within the body.
Expand Down Expand Up @@ -113,19 +120,23 @@ class MyHomePage extends StatelessWidget {
const List<NavigationDestination> destinations = <NavigationDestination>[
NavigationDestination(
label: 'Inbox',
icon: Icon(Icons.inbox, color: Colors.black),
icon: Icon(Icons.inbox_outlined),
selectedIcon: Icon(Icons.inbox),
),
NavigationDestination(
label: 'Articles',
icon: Icon(Icons.article_outlined, color: Colors.black),
icon: Icon(Icons.article_outlined),
selectedIcon: Icon(Icons.article),
),
NavigationDestination(
label: 'Chat',
icon: Icon(Icons.chat_bubble_outline, color: Colors.black),
icon: Icon(Icons.chat_outlined),
selectedIcon: Icon(Icons.chat),
),
NavigationDestination(
label: 'Video',
icon: Icon(Icons.video_call_outlined, color: Colors.black),
icon: Icon(Icons.video_call_outlined),
selectedIcon: Icon(Icons.video_call),
),
];

Expand All @@ -142,6 +153,12 @@ class MyHomePage extends StatelessWidget {
inAnimation: AdaptiveScaffold.leftOutIn,
key: const Key('Primary Navigation Medium'),
builder: (_) => AdaptiveScaffold.standardNavigationRail(
selectedIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
leading: const Icon(Icons.menu),
destinations: destinations
.map((_) => AdaptiveScaffold.toRailDestination(_))
Expand All @@ -152,6 +169,12 @@ class MyHomePage extends StatelessWidget {
key: const Key('Primary Navigation Large'),
inAnimation: AdaptiveScaffold.leftOutIn,
builder: (_) => AdaptiveScaffold.standardNavigationRail(
selectedIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
extended: true,
leading: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
Expand Down Expand Up @@ -197,11 +220,14 @@ class MyHomePage extends StatelessWidget {
key: const Key('Bottom Navigation Small'),
inAnimation: AdaptiveScaffold.bottomToTop,
outAnimation: AdaptiveScaffold.topToBottom,
builder: (_) => BottomNavigationBarTheme(
data: const BottomNavigationBarThemeData(
selectedItemColor: Colors.black),
child: AdaptiveScaffold.standardBottomNavigationBar(
destinations: destinations),
builder: (_) => AdaptiveScaffold.standardBottomNavigationBar(
destinations: destinations,
currentIndex: selectedNavigation,
onDestinationSelected: (int newIndex) {
setState(() {
selectedNavigation = newIndex;
});
},
),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ class MyApp extends StatelessWidget {

/// Creates a basic adaptive page with navigational elements and a body using
/// [AdaptiveScaffold].
class MyHomePage extends StatelessWidget {
class MyHomePage extends StatefulWidget {
/// Creates a const [MyHomePage].
const MyHomePage({super.key});

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _selectedTab = 0;

// #docregion Example
@override
Widget build(BuildContext context) {
Expand All @@ -41,40 +48,60 @@ class MyHomePage extends StatelessWidget {
)
];

return BottomNavigationBarTheme(
data: const BottomNavigationBarThemeData(
unselectedItemColor: Colors.black,
selectedItemColor: Colors.black,
backgroundColor: Colors.white,
return AdaptiveScaffold(
// An option to override the default breakpoints used for small, medium,
// and large.
smallBreakpoint: const WidthPlatformBreakpoint(end: 700),
mediumBreakpoint: const WidthPlatformBreakpoint(begin: 700, end: 1000),
largeBreakpoint: const WidthPlatformBreakpoint(begin: 1000),
useDrawer: false,
selectedIndex: _selectedTab,
onSelectedIndexChange: (int index) {
setState(() {
_selectedTab = index;
});
},
destinations: const <NavigationDestination>[
NavigationDestination(
icon: Icon(Icons.inbox_outlined),
selectedIcon: Icon(Icons.inbox),
label: 'Inbox',
),
NavigationDestination(
icon: Icon(Icons.article_outlined),
selectedIcon: Icon(Icons.article),
label: 'Articles',
),
NavigationDestination(
icon: Icon(Icons.chat_outlined),
selectedIcon: Icon(Icons.chat),
label: 'Chat',
),
NavigationDestination(
icon: Icon(Icons.video_call_outlined),
selectedIcon: Icon(Icons.video_call),
label: 'Video',
),
NavigationDestination(
icon: Icon(Icons.home_outlined),
selectedIcon: Icon(Icons.home),
label: 'Inbox',
),
child: AdaptiveScaffold(
// An option to override the default breakpoints used for small, medium,
// and large.
smallBreakpoint: const WidthPlatformBreakpoint(end: 700),
mediumBreakpoint:
const WidthPlatformBreakpoint(begin: 700, end: 1000),
largeBreakpoint: const WidthPlatformBreakpoint(begin: 1000),
useDrawer: false,
destinations: const <NavigationDestination>[
NavigationDestination(icon: Icon(Icons.inbox), label: 'Inbox'),
NavigationDestination(
icon: Icon(Icons.article), label: 'Articles'),
NavigationDestination(icon: Icon(Icons.chat), label: 'Chat'),
NavigationDestination(
icon: Icon(Icons.video_call), label: 'Video')
],
body: (_) => GridView.count(crossAxisCount: 2, children: children),
smallBody: (_) => ListView.builder(
itemCount: children.length,
itemBuilder: (_, int idx) => children[idx],
),
// Define a default secondaryBody.
secondaryBody: (_) =>
Container(color: const Color.fromARGB(255, 234, 158, 192)),
// Override the default secondaryBody during the smallBreakpoint to be
// empty. Must use AdaptiveScaffold.emptyBuilder to ensure it is properly
// overridden.
smallSecondaryBody: AdaptiveScaffold.emptyBuilder));
],
body: (_) => GridView.count(crossAxisCount: 2, children: children),
smallBody: (_) => ListView.builder(
itemCount: children.length,
itemBuilder: (_, int idx) => children[idx],
),
// Define a default secondaryBody.
secondaryBody: (_) => Container(
color: const Color.fromARGB(255, 234, 158, 192),
),
// Override the default secondaryBody during the smallBreakpoint to be
// empty. Must use AdaptiveScaffold.emptyBuilder to ensure it is properly
// overridden.
smallSecondaryBody: AdaptiveScaffold.emptyBuilder,
);
}
// #enddocregion
// #enddocregion
}
Loading