Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to create a permanent sidebar in Flutter Web?

I've started building a website using Flutter Web, but have come to the issue of being unable to create a persistent sidebar.

Do you know if there is a way to do so, either by somehow making AppBar vertical down the side, or by making a permanent drawer, like the one available in MDC Web?

My original idea was to have a Scaffold with this sidebar persisting across Navigator route changes. I tried playing with nested Navigators, but those didn't help me achieve my desired effect.

Thank you very much for your help
--Jakub

like image 810
Jakub Charvát Avatar asked May 21 '19 18:05

Jakub Charvát


1 Answers

enter image description here

 @override
      Widget build(BuildContext context) {
        return Row(
            children: <Widget>[
              SideLayout(),
              Expanded(
                  flex: 4,
                  child: //your child
              )])
      }

// Side layout file

class SideLayout extends StatelessWidget {
  const SideLayout({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Expanded(
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 20),
          color: Color(0xff404040),
          child: Column(
            children: <Widget>[
              SizedBox(height: 70),
              Image.asset('assets/images/logo.png'),
              Text(
                'Build beautiful Apps',
                textAlign: TextAlign.center,
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 30,
                  fontWeight: FontWeight.w400,

                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
like image 132
Sagar Chavada Avatar answered Oct 16 '22 11:10

Sagar Chavada