v1.0.1animated_sidebar
Flutter के लिए एक संकुचित पक्ष बार प्लगइन, वेब और डेस्कटॉप एप्लिकेशन के लिए अनुकूलित।
Flutter Web और डेस्कटॉप के लिए अनुकूलित एक प्रतिक्रियाशील साइडबार
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
A highly customizable and styleable collapsable sidebar plugin for Flutter, optimized for web and desktop applications.
Add the following to your pubspec.yaml file:
dependencies:
animated_sidebar: ^1.0.0
or use the following command:
flutter pub add animated_sidebar
Add the following import to your dart file:
import 'package:animated_sidebar/animated_sidebar.dart';
define a list of SidebarItem objects:
import 'package:animated_sidebar/animated_sidebar.dart';
final List<SidebarItem> items = [
SidebarItem(icon: Icons.home, text: 'Home'),
SidebarItem(icon: Icons.notifications, text: 'Notifications'),
SidebarItem(icon: Icons.person, text: 'Management'),
];
it is also possible to define multiple SidebarChildItem for every SidebarItem.
import 'package:animated_sidebar/animated_sidebar.dart';
final List<SidebarItem> items = [
SidebarItem(icon: Icons.home, text: 'Home'),
SidebarItem(
icon: Icons.person,
text: 'Management',
children: [
SidebarChildItem(icon: Icons.person, text: 'Users'),
SidebarChildItem(icon: Icons.verified_user, text: 'Roles'),
],
),
];
The Item Containing the Children is Collapsed and expand only on tap. If the Current selected item is a SidebarChildItem the overlying Item keeps expanded
AnimatedSidebarimport 'package:animated_sidebar/animated_sidebar.dart';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Row(
children: [
AnimatedSidebar(
expanded: MediaQuery.of(context).size.width > 600,
items: items,
selectedIndex: 0,
onItemSelected: (index) => print(index),
headerIcon: Icons.ac_unit_sharp,
headerIconColor: Colors.amberAccent,
headerText: 'Example',
),
Center(
child: Text(
'Page: $activeTab',
style: Theme.of(context).textTheme.headline3,
),
),
],
),
);
}
AnimatedSidebar widget and handle state external :import 'package:animated_sidebar/animated_sidebar.dart';
int activeTab = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: Row(
children: [
AnimatedSidebar(
expanded: MediaQuery.of(context).size.width > 600,
items: items,
selectedIndex: activeTab,
autoSelectedIndex: false, // must be false if you want to handle state external
onItemSelected: (index) =>
setState(() => activeTab = index),
headerIcon: Icons.ac_unit_sharp,
headerIconColor: Colors.amberAccent,
headerText: 'Example',
),
Center(
child: Text(
'Page: $activeTab',
style: Theme.of(context).textTheme.headline3,
),
),
],
),
);
}
निर्भरता सूची 3 आइटम
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗