text
stringlengths
1
372
drawer: drawer(
// add a ListView to the drawer. this ensures the user can scroll
// through the options in the drawer if there isn't enough vertical
// space to fit everything.
child: ListView(
// important: remove any padding from the ListView.
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: colors.blue,
),
child: Text('Drawer header'),
),
ListTile(
title: const Text('Home'),
selected: _selectedIndex == 0,
onTap: () {
// update the state of the app
_onItemTapped(0);
// then close the drawer
navigator.pop(context);
},
),
ListTile(
title: const Text('Business'),
selected: _selectedIndex == 1,
onTap: () {
// update the state of the app
_onItemTapped(1);
// then close the drawer
navigator.pop(context);
},
),
ListTile(
title: const Text('School'),
selected: _selectedIndex == 2,
onTap: () {
// update the state of the app
_onItemTapped(2);
// then close the drawer
navigator.pop(context);
},
),
],
),
),
);
}
}
<code_end>
<topic_end>
<topic_start>
deep linking
flutter supports deep linking on iOS, android, and web browsers.
opening a URL displays that screen in your app. with the following
steps, you can launch and display routes by using named routes
(either with the routes parameter or
onGenerateRoute), or by
using the router widget.
info note
named routes are no longer recommended for most
applications. for more information, see
limitations in the navigation overview page.
if you’re running the app in a web browser, there’s no additional setup
required. route paths are handled in the same way as an iOS or android deep
link. by default, web apps read the deep link path from the url fragment using
the pattern: /#/path/to/app/screen, but this can be changed by
configuring the URL strategy for your app.
if you are a visual learner, check out the following video:
deep linking in flutter
<topic_end>
<topic_start>
get started
to get started, see our cookbooks for android and iOS:
<topic_end>
<topic_start>
migrating from plugin-based deep linking
if you have written a plugin to handle deep links, as described in
deep links and flutter applications
(a free article on medium),
it will continue to work until you opt in to this behavior by adding
FlutterDeepLinkingEnabled to info.plist or
flutter_deeplinking_enabled to AndroidManifest.xml, respectively.
<topic_end>
<topic_start>
behavior
the behavior varies slightly based on the platform and whether the app is
launched and running.
when using the router widget,
your app has the ability to replace the
current set of pages when a new deep link
is opened while the app is running.
<topic_end>
<topic_start>
for more information
learning flutter’s new navigation and routing system provides an
introduction to the router system.
<topic_end>
<topic_start>