Skip to content

Can set width for tablet layout ? #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dhachayawat opened this issue Feb 21, 2021 · 3 comments
Closed

Can set width for tablet layout ? #13

dhachayawat opened this issue Feb 21, 2021 · 3 comments

Comments

@dhachayawat
Copy link

same that
Screen Shot 2564-02-22 at 00 57 48

@Vizhan
Copy link

Vizhan commented Feb 22, 2021

@dhachayawat You could do like this:
Do not use Scaffold.floatingActionButtonLocation:
Set AnimatedBottomNavigationBar.gapLocation: as GapLocation.none
Create Custom FAB if needed.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBody: true,
      body: Container(color: Colors.red),
      floatingActionButton: FloatingActionButton(
        elevation: 8,
        child: Icon(Icons.call),
        onPressed: () {},
      ),

      ///No floatingActionButtonLocation here.
      // floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      bottomNavigationBar: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Container(
            constraints: BoxConstraints(maxWidth: 0.6 * MediaQuery.of(context).size.width),
            child: AnimatedBottomNavigationBar.builder(
              itemCount: iconList.length,
              tabBuilder: (int index, bool isActive) {
                final color = isActive ? Colors.green : Colors.white;
                return Column(
                  mainAxisSize: MainAxisSize.min,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Icon(
                      Icons.stream,
                      size: 24,
                      color: color,
                    ),
                    const SizedBox(height: 4),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 8),
                      child: AutoSizeText(
                        "$index",
                        maxLines: 1,
                        style: TextStyle(color: color),
                        group: autoSizeGroup,
                      ),
                    )
                  ],
                );
              },
              backgroundColor: Colors.black,
              activeIndex: Random().nextInt(4),
              splashColor: Colors.green,
              notchAndCornersAnimation: animation,
              splashSpeedInMilliseconds: 300,
              notchSmoothness: NotchSmoothness.defaultEdge,
              gapLocation: GapLocation.none,
              leftCornerRadius: 32,
              rightCornerRadius: 32,
              onTap: (i) {
                setState(() {});
              },
            ),
          ),
        ],
      ),
    );
  }

@dhachayawat
Copy link
Author

Thank you

@vizhan-lanars
Copy link
Collaborator

I'm going to close it for now. Feel free to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants