widget_tray 0.1.1 widget_tray: ^0.1.1 copied to clipboard
A Flutter package with a collection of custom widgets to streamline UI design and simplify app development.
import 'package:flutter/material.dart';
import 'Listtile/listtile_example.dart';
import 'Sidebar/sidebar.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MainScreen(),
);
}
}
class MainScreen extends StatelessWidget {
const MainScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Custom WidgetTray'),
),
body: Column(
children: [
const Text('Example All Wigdet'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
iconButton(
context, Icons.list_outlined, const ExpansionListExample()),
iconButton(context, Icons.view_sidebar, const SidebarExample()),
],
)
],
),
);
}
Widget iconButton(BuildContext context, icon, Widget page) {
return IconButton(
tooltip: '$page',
onPressed: () => navigate(context, page),
icon: Icon(icon));
}
void navigate(BuildContext context, page) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => page,
),
);
}
}