Unexpected padding on side of drawer










0














I'm not sure if this is due to using nested scaffolds, but my drawer has a mysterious padding or margin on the left side of it when it is extended. Changing the width of the sizedbox doesn't change the size of the whitespace either. Also the drawer is really finicky to open.



import 'package:flutter/material.dart';

class NewHome extends StatefulWidget
@override
_NewHomeState createState() => _NewHomeState();


class _NewHomeState extends State<NewHome>
@override
Widget build(BuildContext context)
return Scaffold(
appBar: AppBar(
title: Text("App"),
),
body: Stack(
children: <Widget>[
Align(
alignment: Alignment.centerRight,
child: SizedBox(
width: 285.0,
child: Scaffold(
drawer: Drawer(
child: Container(
color: Theme.of(context).accentColor,
),
),
),
),
),
Container(
color: Theme.of(context).accentColor,
width: 75.0,
child: Column(
children: <Widget>,
),
),
],
),
);




Screenshots:



Closed:
https://i.imgur.com/E4vgoqr.png



Expected:
https://i.imgur.com/hRcfOJ0.png



Actual:
https://i.imgur.com/QMGTKpU.png










share|improve this question


























    0














    I'm not sure if this is due to using nested scaffolds, but my drawer has a mysterious padding or margin on the left side of it when it is extended. Changing the width of the sizedbox doesn't change the size of the whitespace either. Also the drawer is really finicky to open.



    import 'package:flutter/material.dart';

    class NewHome extends StatefulWidget
    @override
    _NewHomeState createState() => _NewHomeState();


    class _NewHomeState extends State<NewHome>
    @override
    Widget build(BuildContext context)
    return Scaffold(
    appBar: AppBar(
    title: Text("App"),
    ),
    body: Stack(
    children: <Widget>[
    Align(
    alignment: Alignment.centerRight,
    child: SizedBox(
    width: 285.0,
    child: Scaffold(
    drawer: Drawer(
    child: Container(
    color: Theme.of(context).accentColor,
    ),
    ),
    ),
    ),
    ),
    Container(
    color: Theme.of(context).accentColor,
    width: 75.0,
    child: Column(
    children: <Widget>,
    ),
    ),
    ],
    ),
    );




    Screenshots:



    Closed:
    https://i.imgur.com/E4vgoqr.png



    Expected:
    https://i.imgur.com/hRcfOJ0.png



    Actual:
    https://i.imgur.com/QMGTKpU.png










    share|improve this question
























      0












      0








      0







      I'm not sure if this is due to using nested scaffolds, but my drawer has a mysterious padding or margin on the left side of it when it is extended. Changing the width of the sizedbox doesn't change the size of the whitespace either. Also the drawer is really finicky to open.



      import 'package:flutter/material.dart';

      class NewHome extends StatefulWidget
      @override
      _NewHomeState createState() => _NewHomeState();


      class _NewHomeState extends State<NewHome>
      @override
      Widget build(BuildContext context)
      return Scaffold(
      appBar: AppBar(
      title: Text("App"),
      ),
      body: Stack(
      children: <Widget>[
      Align(
      alignment: Alignment.centerRight,
      child: SizedBox(
      width: 285.0,
      child: Scaffold(
      drawer: Drawer(
      child: Container(
      color: Theme.of(context).accentColor,
      ),
      ),
      ),
      ),
      ),
      Container(
      color: Theme.of(context).accentColor,
      width: 75.0,
      child: Column(
      children: <Widget>,
      ),
      ),
      ],
      ),
      );




      Screenshots:



      Closed:
      https://i.imgur.com/E4vgoqr.png



      Expected:
      https://i.imgur.com/hRcfOJ0.png



      Actual:
      https://i.imgur.com/QMGTKpU.png










      share|improve this question













      I'm not sure if this is due to using nested scaffolds, but my drawer has a mysterious padding or margin on the left side of it when it is extended. Changing the width of the sizedbox doesn't change the size of the whitespace either. Also the drawer is really finicky to open.



      import 'package:flutter/material.dart';

      class NewHome extends StatefulWidget
      @override
      _NewHomeState createState() => _NewHomeState();


      class _NewHomeState extends State<NewHome>
      @override
      Widget build(BuildContext context)
      return Scaffold(
      appBar: AppBar(
      title: Text("App"),
      ),
      body: Stack(
      children: <Widget>[
      Align(
      alignment: Alignment.centerRight,
      child: SizedBox(
      width: 285.0,
      child: Scaffold(
      drawer: Drawer(
      child: Container(
      color: Theme.of(context).accentColor,
      ),
      ),
      ),
      ),
      ),
      Container(
      color: Theme.of(context).accentColor,
      width: 75.0,
      child: Column(
      children: <Widget>,
      ),
      ),
      ],
      ),
      );




      Screenshots:



      Closed:
      https://i.imgur.com/E4vgoqr.png



      Expected:
      https://i.imgur.com/hRcfOJ0.png



      Actual:
      https://i.imgur.com/QMGTKpU.png







      flutter






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 5:50









      John Stone

      33




      33






















          2 Answers
          2






          active

          oldest

          votes


















          0














          First of all let me explain why doesn't it work properly. First of all, it is aligned to center, therefore it starts from the center and cause this issue. Secondly, since it was at center and you use a stack, you need to find the exact spot the start the drawer, that's why it was acting flaky. For solving it:



          class NewHome extends StatefulWidget 
          @override
          _NewHomeState createState() => _NewHomeState();


          class _NewHomeState extends State<NewHome>
          @override
          Widget build(BuildContext context)
          return Scaffold(
          appBar: AppBar(
          title: Text("App"),
          ),
          body: Stack(
          children: <Widget>[
          //Deleted the blue box because I don't understand why you need it and it was blocking the swipe zone of the drawer
          Container(
          width: 285.0,
          child: Scaffold(
          drawer: Drawer(
          child: Container(
          color: Theme.of(context).accentColor,
          ),
          ),
          ),
          ),
          ],
          ),
          );




          For solution, I played around with the official documentation from here



          import 'package:flutter/material.dart';

          void main() => runApp(MyApp());

          class MyApp extends StatelessWidget
          final appTitle = 'Drawer Demo';

          @override
          Widget build(BuildContext context)
          return MaterialApp(
          title: appTitle,
          home: MyHomePage(title: appTitle),
          );



          class MyHomePage extends StatelessWidget
          final String title;

          MyHomePage(Key key, this.title) : super(key: key);

          @override
          Widget build(BuildContext context)
          return Scaffold(
          appBar: AppBar(title: Text(title)),
          body: Scaffold(
          drawer: Drawer(
          // Add a ListView to the drawer. This ensures the user can scroll
          // through the options in the Drawer if there isn't enough vertical
          // space to fit everything.
          child: ListView(
          // Important: Remove any padding from the ListView.
          padding: EdgeInsets.zero,
          children: <Widget>[
          ListTile(
          title: Text('Item 1'),
          onTap: ()
          // Update the state of the app
          // ...
          // Then close the drawer
          Navigator.pop(context);
          ,
          ),
          ListTile(
          title: Text('Item 2'),
          onTap: ()
          // Update the state of the app
          // ...
          // Then close the drawer
          Navigator.pop(context);
          ,
          ),
          ],
          ),
          ),
          )
          );







          share|improve this answer




















          • The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
            – John Stone
            Nov 11 at 19:06










          • Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
            – salihguler
            Nov 11 at 19:11










          • I added my own answer, when I made your change i realized how the widgets were built.
            – John Stone
            Nov 11 at 19:52










          • No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
            – salihguler
            Nov 11 at 19:57


















          0














          I figured out that flutter builds widgets on top of each other as they are created. This means that the first widget in a stack is below the second one and so on. So the way I solved this was by putting the first container which has the scaffold child in first, with a padding, this allowed the second container which will always be visible to go onto the padding while the drawer can still be opened nicely.



          class _NewHomeState extends State<NewHome> 
          @override
          Widget build(BuildContext context)
          return Scaffold(
          appBar: AppBar(
          title: Text("App"),
          ),
          body: Stack(
          children: <Widget>[
          Padding(
          padding: EdgeInsets.only(left: 74.0),
          child: Container(
          child: Scaffold(
          drawer: Drawer(
          child: Container(
          color: Theme.of(context).accentColor,
          ),
          ),
          ),
          ),
          ),
          Container(
          color: Theme.of(context).accentColor,
          width: 75.0,
          child: Column(
          children: <Widget>,
          ),
          ),
          ],
          ),
          );







          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246196%2funexpected-padding-on-side-of-drawer%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            First of all let me explain why doesn't it work properly. First of all, it is aligned to center, therefore it starts from the center and cause this issue. Secondly, since it was at center and you use a stack, you need to find the exact spot the start the drawer, that's why it was acting flaky. For solving it:



            class NewHome extends StatefulWidget 
            @override
            _NewHomeState createState() => _NewHomeState();


            class _NewHomeState extends State<NewHome>
            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(
            title: Text("App"),
            ),
            body: Stack(
            children: <Widget>[
            //Deleted the blue box because I don't understand why you need it and it was blocking the swipe zone of the drawer
            Container(
            width: 285.0,
            child: Scaffold(
            drawer: Drawer(
            child: Container(
            color: Theme.of(context).accentColor,
            ),
            ),
            ),
            ),
            ],
            ),
            );




            For solution, I played around with the official documentation from here



            import 'package:flutter/material.dart';

            void main() => runApp(MyApp());

            class MyApp extends StatelessWidget
            final appTitle = 'Drawer Demo';

            @override
            Widget build(BuildContext context)
            return MaterialApp(
            title: appTitle,
            home: MyHomePage(title: appTitle),
            );



            class MyHomePage extends StatelessWidget
            final String title;

            MyHomePage(Key key, this.title) : super(key: key);

            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(title: Text(title)),
            body: Scaffold(
            drawer: Drawer(
            // Add a ListView to the drawer. This ensures the user can scroll
            // through the options in the Drawer if there isn't enough vertical
            // space to fit everything.
            child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
            ListTile(
            title: Text('Item 1'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ListTile(
            title: Text('Item 2'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ],
            ),
            ),
            )
            );







            share|improve this answer




















            • The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
              – John Stone
              Nov 11 at 19:06










            • Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
              – salihguler
              Nov 11 at 19:11










            • I added my own answer, when I made your change i realized how the widgets were built.
              – John Stone
              Nov 11 at 19:52










            • No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
              – salihguler
              Nov 11 at 19:57















            0














            First of all let me explain why doesn't it work properly. First of all, it is aligned to center, therefore it starts from the center and cause this issue. Secondly, since it was at center and you use a stack, you need to find the exact spot the start the drawer, that's why it was acting flaky. For solving it:



            class NewHome extends StatefulWidget 
            @override
            _NewHomeState createState() => _NewHomeState();


            class _NewHomeState extends State<NewHome>
            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(
            title: Text("App"),
            ),
            body: Stack(
            children: <Widget>[
            //Deleted the blue box because I don't understand why you need it and it was blocking the swipe zone of the drawer
            Container(
            width: 285.0,
            child: Scaffold(
            drawer: Drawer(
            child: Container(
            color: Theme.of(context).accentColor,
            ),
            ),
            ),
            ),
            ],
            ),
            );




            For solution, I played around with the official documentation from here



            import 'package:flutter/material.dart';

            void main() => runApp(MyApp());

            class MyApp extends StatelessWidget
            final appTitle = 'Drawer Demo';

            @override
            Widget build(BuildContext context)
            return MaterialApp(
            title: appTitle,
            home: MyHomePage(title: appTitle),
            );



            class MyHomePage extends StatelessWidget
            final String title;

            MyHomePage(Key key, this.title) : super(key: key);

            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(title: Text(title)),
            body: Scaffold(
            drawer: Drawer(
            // Add a ListView to the drawer. This ensures the user can scroll
            // through the options in the Drawer if there isn't enough vertical
            // space to fit everything.
            child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
            ListTile(
            title: Text('Item 1'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ListTile(
            title: Text('Item 2'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ],
            ),
            ),
            )
            );







            share|improve this answer




















            • The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
              – John Stone
              Nov 11 at 19:06










            • Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
              – salihguler
              Nov 11 at 19:11










            • I added my own answer, when I made your change i realized how the widgets were built.
              – John Stone
              Nov 11 at 19:52










            • No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
              – salihguler
              Nov 11 at 19:57













            0












            0








            0






            First of all let me explain why doesn't it work properly. First of all, it is aligned to center, therefore it starts from the center and cause this issue. Secondly, since it was at center and you use a stack, you need to find the exact spot the start the drawer, that's why it was acting flaky. For solving it:



            class NewHome extends StatefulWidget 
            @override
            _NewHomeState createState() => _NewHomeState();


            class _NewHomeState extends State<NewHome>
            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(
            title: Text("App"),
            ),
            body: Stack(
            children: <Widget>[
            //Deleted the blue box because I don't understand why you need it and it was blocking the swipe zone of the drawer
            Container(
            width: 285.0,
            child: Scaffold(
            drawer: Drawer(
            child: Container(
            color: Theme.of(context).accentColor,
            ),
            ),
            ),
            ),
            ],
            ),
            );




            For solution, I played around with the official documentation from here



            import 'package:flutter/material.dart';

            void main() => runApp(MyApp());

            class MyApp extends StatelessWidget
            final appTitle = 'Drawer Demo';

            @override
            Widget build(BuildContext context)
            return MaterialApp(
            title: appTitle,
            home: MyHomePage(title: appTitle),
            );



            class MyHomePage extends StatelessWidget
            final String title;

            MyHomePage(Key key, this.title) : super(key: key);

            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(title: Text(title)),
            body: Scaffold(
            drawer: Drawer(
            // Add a ListView to the drawer. This ensures the user can scroll
            // through the options in the Drawer if there isn't enough vertical
            // space to fit everything.
            child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
            ListTile(
            title: Text('Item 1'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ListTile(
            title: Text('Item 2'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ],
            ),
            ),
            )
            );







            share|improve this answer












            First of all let me explain why doesn't it work properly. First of all, it is aligned to center, therefore it starts from the center and cause this issue. Secondly, since it was at center and you use a stack, you need to find the exact spot the start the drawer, that's why it was acting flaky. For solving it:



            class NewHome extends StatefulWidget 
            @override
            _NewHomeState createState() => _NewHomeState();


            class _NewHomeState extends State<NewHome>
            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(
            title: Text("App"),
            ),
            body: Stack(
            children: <Widget>[
            //Deleted the blue box because I don't understand why you need it and it was blocking the swipe zone of the drawer
            Container(
            width: 285.0,
            child: Scaffold(
            drawer: Drawer(
            child: Container(
            color: Theme.of(context).accentColor,
            ),
            ),
            ),
            ),
            ],
            ),
            );




            For solution, I played around with the official documentation from here



            import 'package:flutter/material.dart';

            void main() => runApp(MyApp());

            class MyApp extends StatelessWidget
            final appTitle = 'Drawer Demo';

            @override
            Widget build(BuildContext context)
            return MaterialApp(
            title: appTitle,
            home: MyHomePage(title: appTitle),
            );



            class MyHomePage extends StatelessWidget
            final String title;

            MyHomePage(Key key, this.title) : super(key: key);

            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(title: Text(title)),
            body: Scaffold(
            drawer: Drawer(
            // Add a ListView to the drawer. This ensures the user can scroll
            // through the options in the Drawer if there isn't enough vertical
            // space to fit everything.
            child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
            ListTile(
            title: Text('Item 1'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ListTile(
            title: Text('Item 2'),
            onTap: ()
            // Update the state of the app
            // ...
            // Then close the drawer
            Navigator.pop(context);
            ,
            ),
            ],
            ),
            ),
            )
            );








            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 11 at 13:21









            salihguler

            528617




            528617











            • The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
              – John Stone
              Nov 11 at 19:06










            • Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
              – salihguler
              Nov 11 at 19:11










            • I added my own answer, when I made your change i realized how the widgets were built.
              – John Stone
              Nov 11 at 19:52










            • No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
              – salihguler
              Nov 11 at 19:57
















            • The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
              – John Stone
              Nov 11 at 19:06










            • Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
              – salihguler
              Nov 11 at 19:11










            • I added my own answer, when I made your change i realized how the widgets were built.
              – John Stone
              Nov 11 at 19:52










            • No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
              – salihguler
              Nov 11 at 19:57















            The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
            – John Stone
            Nov 11 at 19:06




            The box on the left side was going to hold images which I wanted always visible and I wanted it so that when you swipe right it extends the blue-grey box with the images so that a description is visible. If that makes sense.
            – John Stone
            Nov 11 at 19:06












            Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
            – salihguler
            Nov 11 at 19:11




            Okay I see. So your question was "Unexpected padding on side of drawer" and I believe it answers with the answer above.
            – salihguler
            Nov 11 at 19:11












            I added my own answer, when I made your change i realized how the widgets were built.
            – John Stone
            Nov 11 at 19:52




            I added my own answer, when I made your change i realized how the widgets were built.
            – John Stone
            Nov 11 at 19:52












            No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
            – salihguler
            Nov 11 at 19:57




            No, it's building on top of eachother because of the Stack. But anyway, if my answer helped, you can accept it.
            – salihguler
            Nov 11 at 19:57













            0














            I figured out that flutter builds widgets on top of each other as they are created. This means that the first widget in a stack is below the second one and so on. So the way I solved this was by putting the first container which has the scaffold child in first, with a padding, this allowed the second container which will always be visible to go onto the padding while the drawer can still be opened nicely.



            class _NewHomeState extends State<NewHome> 
            @override
            Widget build(BuildContext context)
            return Scaffold(
            appBar: AppBar(
            title: Text("App"),
            ),
            body: Stack(
            children: <Widget>[
            Padding(
            padding: EdgeInsets.only(left: 74.0),
            child: Container(
            child: Scaffold(
            drawer: Drawer(
            child: Container(
            color: Theme.of(context).accentColor,
            ),
            ),
            ),
            ),
            ),
            Container(
            color: Theme.of(context).accentColor,
            width: 75.0,
            child: Column(
            children: <Widget>,
            ),
            ),
            ],
            ),
            );







            share|improve this answer



























              0














              I figured out that flutter builds widgets on top of each other as they are created. This means that the first widget in a stack is below the second one and so on. So the way I solved this was by putting the first container which has the scaffold child in first, with a padding, this allowed the second container which will always be visible to go onto the padding while the drawer can still be opened nicely.



              class _NewHomeState extends State<NewHome> 
              @override
              Widget build(BuildContext context)
              return Scaffold(
              appBar: AppBar(
              title: Text("App"),
              ),
              body: Stack(
              children: <Widget>[
              Padding(
              padding: EdgeInsets.only(left: 74.0),
              child: Container(
              child: Scaffold(
              drawer: Drawer(
              child: Container(
              color: Theme.of(context).accentColor,
              ),
              ),
              ),
              ),
              ),
              Container(
              color: Theme.of(context).accentColor,
              width: 75.0,
              child: Column(
              children: <Widget>,
              ),
              ),
              ],
              ),
              );







              share|improve this answer

























                0












                0








                0






                I figured out that flutter builds widgets on top of each other as they are created. This means that the first widget in a stack is below the second one and so on. So the way I solved this was by putting the first container which has the scaffold child in first, with a padding, this allowed the second container which will always be visible to go onto the padding while the drawer can still be opened nicely.



                class _NewHomeState extends State<NewHome> 
                @override
                Widget build(BuildContext context)
                return Scaffold(
                appBar: AppBar(
                title: Text("App"),
                ),
                body: Stack(
                children: <Widget>[
                Padding(
                padding: EdgeInsets.only(left: 74.0),
                child: Container(
                child: Scaffold(
                drawer: Drawer(
                child: Container(
                color: Theme.of(context).accentColor,
                ),
                ),
                ),
                ),
                ),
                Container(
                color: Theme.of(context).accentColor,
                width: 75.0,
                child: Column(
                children: <Widget>,
                ),
                ),
                ],
                ),
                );







                share|improve this answer














                I figured out that flutter builds widgets on top of each other as they are created. This means that the first widget in a stack is below the second one and so on. So the way I solved this was by putting the first container which has the scaffold child in first, with a padding, this allowed the second container which will always be visible to go onto the padding while the drawer can still be opened nicely.



                class _NewHomeState extends State<NewHome> 
                @override
                Widget build(BuildContext context)
                return Scaffold(
                appBar: AppBar(
                title: Text("App"),
                ),
                body: Stack(
                children: <Widget>[
                Padding(
                padding: EdgeInsets.only(left: 74.0),
                child: Container(
                child: Scaffold(
                drawer: Drawer(
                child: Container(
                color: Theme.of(context).accentColor,
                ),
                ),
                ),
                ),
                ),
                Container(
                color: Theme.of(context).accentColor,
                width: 75.0,
                child: Column(
                children: <Widget>,
                ),
                ),
                ],
                ),
                );








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 11 at 19:27

























                answered Nov 11 at 19:19









                John Stone

                33




                33



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246196%2funexpected-padding-on-side-of-drawer%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Darth Vader #20

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Ondo