text stringlengths 1 474 |
|---|
]; |
void _onItemTapped(int index) { |
setState(() { |
_selectedIndex = index; |
}); |
} |
@override |
Widget build(BuildContext context) { |
return Scaffold( |
appBar: AppBar(title: Text(widget.title)), |
body: Center( |
child: _widgetOptions[_selectedIndex], |
), |
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> |
To learn more |
<topic_end> |
<topic_start>Set up app links for Android |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.