tabpanel 0.1.0 copy "tabpanel: ^0.1.0" to clipboard
tabpanel: ^0.1.0 copied to clipboard

outdated

Tabbed inferface with support for nested and resizeable panels.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:tabpanel/tabpanel.dart';

void main() async {
  final tabPanel = TabPanel(defaultPage: PageA());

  runApp(
    MaterialApp(
      home: TabPanelWidget(tabPanel),
    ),
  );
}

class PageA extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final tab = ParentTab.of(context);
    return Column(
      children: [
        Icon(Icons.construction, size: 56),
        Text('Page A'),
        Divider(),
        Wrap(
          children: [
            RaisedButton.icon(
              icon: Icon(Icons.open_in_browser),
              onPressed: () => tab?.push(PageB()),
              label: Text('Page B'),
            ),
            SizedBox(width: 16),
            RaisedButton.icon(
              icon: Icon(Icons.open_in_new),
              onPressed: () => tab?.push(PageB(), forceNewTab: true),
              label: Text('Page B'),
            ),
          ],
        )
      ],
    );
  }
}

class PageB extends StatelessWidget with TabPageMixin {
  @override
  final String title = 'PageB';

  @override
  final Icon icon = const Icon(Icons.dashboard);

  @override
  final IconData iconData = Icons.dashboard;

  @override
  Widget build(BuildContext context) {
    final tab = ParentTab.of(context);
    return Column(
      children: [
        Icon(Icons.construction_outlined, size: 56),
        Text('Page B'),
        Divider(),
        Wrap(
          children: [
            RaisedButton.icon(
              icon: Icon(Icons.open_in_browser),
              onPressed: () => tab?.push(PageC()),
              label: Text('Page C'),
            ),
            SizedBox(width: 16),
            RaisedButton.icon(
              icon: Icon(Icons.open_in_new),
              onPressed: () => tab?.push(PageC(), forceNewTab: true),
              label: Text('Page C'),
            ),
            SizedBox(width: 16),
            if ((tab?.pages?.length ?? 0) > 1)
              RaisedButton.icon(
                icon: Icon(Icons.navigate_before),
                onPressed: tab?.pop,
                label: Text('Go back'),
              ),
          ],
        )
      ],
    );
  }
}

class PageC extends StatelessWidget with TabPageMixin {
  @override
  final String title = 'PageC';

  @override
  final IconData iconData = Icons.work;

  @override
  Widget build(BuildContext context) {
    final tab = ParentTab.of(context);
    return Column(
      children: [
        Icon(Icons.construction_outlined, size: 56),
        Text('Page C'),
        Divider(),
        Wrap(
          children: [
            if ((tab?.pages?.length ?? 0) > 1)
              RaisedButton.icon(
                icon: Icon(Icons.navigate_before),
                onPressed: tab?.pop,
                label: Text('Go back'),
              ),
          ],
        )
      ],
    );
  }
}
17
likes
0
pub points
36%
popularity

Publisher

unverified uploader

Tabbed inferface with support for nested and resizeable panels.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_mobx, mobx, uuid

More

Packages that depend on tabpanel