Position buttons in a card. Flutter












0















I am having some troubles to position 2 buttons in a card in Flutter.
I had this:
before



But I want this:
after



My code for the buttons of this card is:



new ButtonTheme.bar(
child: new ButtonBar(
alignment: MainAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(
children: <Widget>[
new FlatButton(
child: Icon(
Icons.share,
color: Colors.white,
),
color: Color.fromRGBO(68, 153, 213, 1.0),
shape: CircleBorder(),
onPressed: () {
Share.share(
data[index]["link"],
);
},
),
],
),
Column(
children: <Widget>[
FlatButton(
color:
Color.fromRGBO(161, 108, 164, 1.0),
child: const Text('Read Article'),
shape: new RoundedRectangleBorder(
borderRadius:
new BorderRadius.circular(
30.0)),
textColor: Colors.white,
onPressed: () {
launch(data[index]["link"],
forceWebView: false);
},
),
],

)
],
),

],
),









share|improve this question





























    0















    I am having some troubles to position 2 buttons in a card in Flutter.
    I had this:
    before



    But I want this:
    after



    My code for the buttons of this card is:



    new ButtonTheme.bar(
    child: new ButtonBar(
    alignment: MainAxisAlignment.start,
    children: <Widget>[
    Row(
    children: <Widget>[
    Column(
    children: <Widget>[
    new FlatButton(
    child: Icon(
    Icons.share,
    color: Colors.white,
    ),
    color: Color.fromRGBO(68, 153, 213, 1.0),
    shape: CircleBorder(),
    onPressed: () {
    Share.share(
    data[index]["link"],
    );
    },
    ),
    ],
    ),
    Column(
    children: <Widget>[
    FlatButton(
    color:
    Color.fromRGBO(161, 108, 164, 1.0),
    child: const Text('Read Article'),
    shape: new RoundedRectangleBorder(
    borderRadius:
    new BorderRadius.circular(
    30.0)),
    textColor: Colors.white,
    onPressed: () {
    launch(data[index]["link"],
    forceWebView: false);
    },
    ),
    ],

    )
    ],
    ),

    ],
    ),









    share|improve this question



























      0












      0








      0








      I am having some troubles to position 2 buttons in a card in Flutter.
      I had this:
      before



      But I want this:
      after



      My code for the buttons of this card is:



      new ButtonTheme.bar(
      child: new ButtonBar(
      alignment: MainAxisAlignment.start,
      children: <Widget>[
      Row(
      children: <Widget>[
      Column(
      children: <Widget>[
      new FlatButton(
      child: Icon(
      Icons.share,
      color: Colors.white,
      ),
      color: Color.fromRGBO(68, 153, 213, 1.0),
      shape: CircleBorder(),
      onPressed: () {
      Share.share(
      data[index]["link"],
      );
      },
      ),
      ],
      ),
      Column(
      children: <Widget>[
      FlatButton(
      color:
      Color.fromRGBO(161, 108, 164, 1.0),
      child: const Text('Read Article'),
      shape: new RoundedRectangleBorder(
      borderRadius:
      new BorderRadius.circular(
      30.0)),
      textColor: Colors.white,
      onPressed: () {
      launch(data[index]["link"],
      forceWebView: false);
      },
      ),
      ],

      )
      ],
      ),

      ],
      ),









      share|improve this question
















      I am having some troubles to position 2 buttons in a card in Flutter.
      I had this:
      before



      But I want this:
      after



      My code for the buttons of this card is:



      new ButtonTheme.bar(
      child: new ButtonBar(
      alignment: MainAxisAlignment.start,
      children: <Widget>[
      Row(
      children: <Widget>[
      Column(
      children: <Widget>[
      new FlatButton(
      child: Icon(
      Icons.share,
      color: Colors.white,
      ),
      color: Color.fromRGBO(68, 153, 213, 1.0),
      shape: CircleBorder(),
      onPressed: () {
      Share.share(
      data[index]["link"],
      );
      },
      ),
      ],
      ),
      Column(
      children: <Widget>[
      FlatButton(
      color:
      Color.fromRGBO(161, 108, 164, 1.0),
      child: const Text('Read Article'),
      shape: new RoundedRectangleBorder(
      borderRadius:
      new BorderRadius.circular(
      30.0)),
      textColor: Colors.white,
      onPressed: () {
      launch(data[index]["link"],
      forceWebView: false);
      },
      ),
      ],

      )
      ],
      ),

      ],
      ),






      dart flutter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 16:52









      dferenc

      4,831122333




      4,831122333










      asked Nov 26 '18 at 12:29









      Pedro MoreiraPedro Moreira

      82




      82
























          2 Answers
          2






          active

          oldest

          votes


















          1














          From the documentation




          ButtonBar.children : The buttons to arrange horizontally




          I think you are doing a lot of unnecessary stuff, to get the result just put the buttons inside ButtonBar without extra layout widgets like Row and Column



          enter image description here



          here is the code :



          ButtonTheme.bar(
          child: new ButtonBar(
          alignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
          FlatButton(
          child: Icon(
          Icons.share,
          color: Colors.white,
          ),
          color: Color.fromRGBO(68, 153, 213, 1.0),
          shape: CircleBorder(),
          onPressed: () {},
          ),
          FlatButton(
          color: Color.fromRGBO(161, 108, 164, 1.0),
          child: const Text('Read Article'),
          shape: new RoundedRectangleBorder(
          borderRadius: new BorderRadius.circular(30.0)),
          textColor: Colors.white,
          onPressed: () {},
          ),
          ],
          ),
          ),





          share|improve this answer


























          • Working, thanks

            – Pedro Moreira
            Nov 26 '18 at 16:12



















          1














          You can use a different alignment on your ButtonBar or Row:



          alignment: MainAxisAlignment.spaceBetween





          share|improve this answer
























          • doesn't work man

            – Pedro Moreira
            Nov 26 '18 at 12:46












          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%2f53481148%2fposition-buttons-in-a-card-flutter%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









          1














          From the documentation




          ButtonBar.children : The buttons to arrange horizontally




          I think you are doing a lot of unnecessary stuff, to get the result just put the buttons inside ButtonBar without extra layout widgets like Row and Column



          enter image description here



          here is the code :



          ButtonTheme.bar(
          child: new ButtonBar(
          alignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
          FlatButton(
          child: Icon(
          Icons.share,
          color: Colors.white,
          ),
          color: Color.fromRGBO(68, 153, 213, 1.0),
          shape: CircleBorder(),
          onPressed: () {},
          ),
          FlatButton(
          color: Color.fromRGBO(161, 108, 164, 1.0),
          child: const Text('Read Article'),
          shape: new RoundedRectangleBorder(
          borderRadius: new BorderRadius.circular(30.0)),
          textColor: Colors.white,
          onPressed: () {},
          ),
          ],
          ),
          ),





          share|improve this answer


























          • Working, thanks

            – Pedro Moreira
            Nov 26 '18 at 16:12
















          1














          From the documentation




          ButtonBar.children : The buttons to arrange horizontally




          I think you are doing a lot of unnecessary stuff, to get the result just put the buttons inside ButtonBar without extra layout widgets like Row and Column



          enter image description here



          here is the code :



          ButtonTheme.bar(
          child: new ButtonBar(
          alignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
          FlatButton(
          child: Icon(
          Icons.share,
          color: Colors.white,
          ),
          color: Color.fromRGBO(68, 153, 213, 1.0),
          shape: CircleBorder(),
          onPressed: () {},
          ),
          FlatButton(
          color: Color.fromRGBO(161, 108, 164, 1.0),
          child: const Text('Read Article'),
          shape: new RoundedRectangleBorder(
          borderRadius: new BorderRadius.circular(30.0)),
          textColor: Colors.white,
          onPressed: () {},
          ),
          ],
          ),
          ),





          share|improve this answer


























          • Working, thanks

            – Pedro Moreira
            Nov 26 '18 at 16:12














          1












          1








          1







          From the documentation




          ButtonBar.children : The buttons to arrange horizontally




          I think you are doing a lot of unnecessary stuff, to get the result just put the buttons inside ButtonBar without extra layout widgets like Row and Column



          enter image description here



          here is the code :



          ButtonTheme.bar(
          child: new ButtonBar(
          alignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
          FlatButton(
          child: Icon(
          Icons.share,
          color: Colors.white,
          ),
          color: Color.fromRGBO(68, 153, 213, 1.0),
          shape: CircleBorder(),
          onPressed: () {},
          ),
          FlatButton(
          color: Color.fromRGBO(161, 108, 164, 1.0),
          child: const Text('Read Article'),
          shape: new RoundedRectangleBorder(
          borderRadius: new BorderRadius.circular(30.0)),
          textColor: Colors.white,
          onPressed: () {},
          ),
          ],
          ),
          ),





          share|improve this answer















          From the documentation




          ButtonBar.children : The buttons to arrange horizontally




          I think you are doing a lot of unnecessary stuff, to get the result just put the buttons inside ButtonBar without extra layout widgets like Row and Column



          enter image description here



          here is the code :



          ButtonTheme.bar(
          child: new ButtonBar(
          alignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
          FlatButton(
          child: Icon(
          Icons.share,
          color: Colors.white,
          ),
          color: Color.fromRGBO(68, 153, 213, 1.0),
          shape: CircleBorder(),
          onPressed: () {},
          ),
          FlatButton(
          color: Color.fromRGBO(161, 108, 164, 1.0),
          child: const Text('Read Article'),
          shape: new RoundedRectangleBorder(
          borderRadius: new BorderRadius.circular(30.0)),
          textColor: Colors.white,
          onPressed: () {},
          ),
          ],
          ),
          ),






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 9 '18 at 23:16









          Sami

          9,29331244




          9,29331244










          answered Nov 26 '18 at 13:34









          Raouf RahicheRaouf Rahiche

          4,82721533




          4,82721533













          • Working, thanks

            – Pedro Moreira
            Nov 26 '18 at 16:12



















          • Working, thanks

            – Pedro Moreira
            Nov 26 '18 at 16:12

















          Working, thanks

          – Pedro Moreira
          Nov 26 '18 at 16:12





          Working, thanks

          – Pedro Moreira
          Nov 26 '18 at 16:12













          1














          You can use a different alignment on your ButtonBar or Row:



          alignment: MainAxisAlignment.spaceBetween





          share|improve this answer
























          • doesn't work man

            – Pedro Moreira
            Nov 26 '18 at 12:46
















          1














          You can use a different alignment on your ButtonBar or Row:



          alignment: MainAxisAlignment.spaceBetween





          share|improve this answer
























          • doesn't work man

            – Pedro Moreira
            Nov 26 '18 at 12:46














          1












          1








          1







          You can use a different alignment on your ButtonBar or Row:



          alignment: MainAxisAlignment.spaceBetween





          share|improve this answer













          You can use a different alignment on your ButtonBar or Row:



          alignment: MainAxisAlignment.spaceBetween






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 12:35









          Rémi RousseletRémi Rousselet

          36.2k484110




          36.2k484110













          • doesn't work man

            – Pedro Moreira
            Nov 26 '18 at 12:46



















          • doesn't work man

            – Pedro Moreira
            Nov 26 '18 at 12:46

















          doesn't work man

          – Pedro Moreira
          Nov 26 '18 at 12:46





          doesn't work man

          – Pedro Moreira
          Nov 26 '18 at 12:46


















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481148%2fposition-buttons-in-a-card-flutter%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

          Costa Masnaga

          Fotorealismo

          Sidney Franklin