Header Ads Widget

Responsive Advertisement

Navigation Drawer in flutter

 import 'package:drawer/drawer.dart';

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
          drawer: MainDrawer(),
          appBar: AppBar(
            title: Text("Drawer"),
          )),
    );
  }
}


............................................................................

import 'package:flutter/material.dart';

class MainDrawer extends StatefulWidget {
  const MainDrawer({Key? key}) : super(key: key);

  @override
  State<MainDrawer> createState() => _MainDrawerState();
}

class _MainDrawerState extends State<MainDrawer> {
  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: SingleChildScrollView(
        child: Column(
          children: [
            Stack(children: [
              Container(
                height: 110,
                color: Colors.amber,
              ),
              Row(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(top: 30, left: 20),
                    child: CircleAvatar(
                      backgroundColor: Colors.amber,
                      radius: 50,
                      child: CircleAvatar(
                          // backgroundColor: Colors.indigo,
                          radius: 45,
                          backgroundImage: AssetImage('images/rahim.jpg')),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 10),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text(
                          'Abdul Rahim',
                          style: TextStyle(fontSize: 20),
                        ),
                        Text(
                          'rahimsr983@gmail.com',
                          style: TextStyle(fontSize: 15),
                        )
                      ],
                    ),
                  )
                ],
              )
            ]),

            GestureDetector(
              onTap: () {
                Navigator.pushNamed(context, '\Homepahe');
              },
              child: items(
                  title: 'Home', leading: Icons.home, color: Colors.indigo),
            ),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            items(title: 'Home', leading: Icons.home, color: Colors.indigo),
            // Divider(),
            GestureDetector(
              onTap: () {
                Navigator.pushNamed(context, '\reviewcart');
              },
              child: items(
                  title: 'Review Cart',
                  leading: Icons.shop_outlined,
                  color: Colors.purple),
            ),
            // Divider(),
            GestureDetector(
              onTap: () {
                Navigator.pushNamed(context, '\profile');
              },
              child: items(
                  title: 'My Profile',
                  leading: Icons.person,
                  color: Colors.pink),
            ),
            // Divider(),
            items(
                title: 'Notification',
                leading: Icons.notification_add,
                color: Colors.amber),
            // Divider(),
            items(
                title: 'Rating and Review',
                leading: Icons.star,
                color: Colors.blue),
            // Divider(),
            GestureDetector(
              onTap: () {
                Navigator.pushNamed(context, '\whistlist');
              },
              child: items(
                  title: 'Whistlist', leading: Icons.shop, color: Colors.brown),
            ),

            // Divider(),
            SizedBox(
              height: 20,
            ),
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  'Contact to Support',
                  style: TextStyle(
                      fontSize: 30, color: Colors.indigo, fontFamily: 'rrr'),
                ),
                Text(
                  ' Call: 01718663032',
                  style: TextStyle(fontSize: 17, fontFamily: 'rrr'),
                ),
                Text(
                  'mail: rahimsr983@gmail.com',
                  style: TextStyle(fontSize: 17, fontFamily: 'rrr'),
                )
              ],
            )
          ],
        ),
      ),
    );
  }

  items({title, leading, color}) {
    return ListView(
      shrinkWrap: true,
      children: [
        ListTile(
          leading: Icon(
            leading,
            color: color,
          ),
          title: Text(
            title,
            style: TextStyle(fontSize: 20, fontFamily: 'rrr'),
          ),
        ),
      ],
    );
  }
}


একটি মন্তব্য পোস্ট করুন

0 মন্তব্যসমূহ