Coder Social home page Coder Social logo

Comments (2)

fzyzcjy avatar fzyzcjy commented on June 18, 2024

Maybe it is not a bug of mobx? And you may need to show a minimal reproducible sample

from mobx.dart.

chuckd853 avatar chuckd853 commented on June 18, 2024

yes of course. Sorry Forgot to add the code...

This is the original code of the main app:

body: TabBarView(
          children: [
            Row(
              children: [
                Expanded(flex: 25, child: TodoExample()),    // here's the widget
                Expanded(
                  flex: 75,
                  child: Container(
                    decoration: BoxDecoration(
                      border: Border(
                        left: BorderSide(width: 2, color: Colors.black38),
                      ),
                    ),
                    child: CanvasWidget(),
                  ),
                ),
              ],
            ), //this is a full blank page to draw on
            NetworkWidget(),
            MapWidget(),
          ],
        ),

I tried wrapping the widget in a column:

body: TabBarView(
          children: [
            Row(
              children: [
                   Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      chidren: [
                        TodoExample()),    // here's the widget
                       ],),
                Expanded(
                  flex: 75, 
                  // more code

Here's the original relevant part of the widget code from github:

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

  @override
  Widget build(BuildContext context) {
    final list = Provider.of<TodoList>(context);

    return Column(children: <Widget>[
      Observer(
        builder: (_) {
          final selections = VisibilityFilter.values.map((f) => f == list.filter).toList(growable: false);
          return Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(top: 8),
                child: ToggleButtons(
                  borderRadius: BorderRadius.circular(8),
                  onPressed: (index) {
                    list.filter = VisibilityFilter.values[index];
                  },
                  isSelected: selections,
                  children: const <Widget>[
                    Padding(
                      padding: EdgeInsets.only(left: 5, right: 5),
                      child: Text('All'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(left: 5, right: 5),
                      child: Text('Pending'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(left: 5, right: 5),
                      child: Text('Completed'),
                    )
                  ],
                ),
              ),
            ],
          );
        },
      ),
      Observer(
          builder: (_) => ButtonBar(
                children: <Widget>[
                  ElevatedButton(
                    onPressed: list.canRemoveAllCompleted ? list.removeCompleted : null,
                    child: const Text('Remove Completed'),
                  ),
                  ElevatedButton(
                    onPressed: list.canMarkAllCompleted ? list.markAllAsCompleted : null,
                    child: const Text('Mark All Completed'),
                  )
                ],
              ))
    ]);
  }
}

Then I tried wrapping the buttons in a column:

      Observer(
          builder: (_) => ButtonBar(
                Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: <Widget>[
                  ElevatedButton(
                    onPressed: list.canRemoveAllCompleted ? list.removeCompleted : null,
                    child: const Text('Remove Completed'),
                  ),
                  ElevatedButton(
                    onPressed: list.canMarkAllCompleted ? list.markAllAsCompleted : null,
                    child: const Text('Mark All Completed'),
                  )
                ],
              ),

from mobx.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.