tridimensional_drawer 0.1.0 tridimensional_drawer: ^0.1.0 copied to clipboard
Tridimensional Drawer is an easy way to create a 3D Perspective drawer, where you can insert any type of widget.
import 'package:flutter/material.dart';
import 'package:tridimensional_drawer/tridimensional_drawer.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Example App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Example(),
);
}
}
class Example extends StatefulWidget {
@override
_ExampleState createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
final TridimensionalDrawerController controller =
TridimensionalDrawerController();
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return TridimensionalDrawer(
controller: controller,
mainPage: GestureDetector(
onTap: () => controller.open(),
child: MainPage(),
),
drawer: CustomDrawer(),
backgroundPage: GestureDetector(
onTap: () => controller.close(),
child: Container(
color: Colors.white,
),
),
);
}
}
class MainPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.blue[600],
Colors.blue[800],
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
),
child: Center(
child: Text(
'Main Page',
style: TextStyle(color: Colors.white, fontSize: 24.0),
),
),
),
);
}
}
class CustomDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.blue[600],
Colors.blue[800],
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Center(
child: Text(
'Drawer',
style: TextStyle(color: Colors.white, fontSize: 24.0),
),
),
),
);
}
}