neos_bottom_navigation 0.1.2 copy "neos_bottom_navigation: ^0.1.2" to clipboard
neos_bottom_navigation: ^0.1.2 copied to clipboard

outdated

A bottom navigation bar widget that is made to be customized

example/lib/main.dart

/*
Initial development sponsored by Zaynin Pty (Ltd)
*/

import 'package:example/neos_icons.dart';
import 'package:neos_bottom_navigation/neos_bottom_navigation.dart';
import 'package:neos_bottom_navigation/neos_bottom_navigation_item.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: TestScreen(),
    );
  }
}

class TestScreen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return TestScreenState();
  }
}

class TestScreenState extends State<TestScreen> {
  PageController _pageController = PageController();

  //int _setIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          _buildBody(),
          _buildNavBar(),
        ],
      ),
    );
  }

  Widget _buildBody() {
    return SingleChildScrollView(
      child: Container(
        decoration: BoxDecoration(
            gradient: LinearGradient(
          colors: [Colors.red, Colors.green],
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter,
        )),
        child: Center(
          child: Container(
            color: Colors.red,
            child: Center(
              child: Icon(NeosIcons.courses),
            ),
          ),
        ),
      ),
    );
  }

  Widget _buildNavBar() {
    return Align(
      alignment: Alignment.bottomCenter,
      child: NeosBottomNavigation(
        //setIndex: _setIndex,
        items: [
          NeosBottomNavigationItem(
            icon: Icon(NeosIcons.alerts),
            title: "Map",
          ),
          NeosBottomNavigationItem(
            icon: Icon(NeosIcons.courses),
            title: "Directions",
          ),
          NeosBottomNavigationItem(
            icon: Icon(NeosIcons.calendar),
            title: "Settings",
          ),
        ],
        onTap: (index) {
          _pageController.animateToPage(index,
              curve: Curves.fastLinearToSlowEaseIn,
              duration: Duration(milliseconds: 600));
        },
      ),
    );
  }

  /*
  void _changeIndexPlus() {
    setState(() {
      _setIndex++;
    });
  }

  void _changeIndexMinus() {
    setState(() {
      _setIndex--;
    });
  }
  */
}
14
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A bottom navigation bar widget that is made to be customized

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on neos_bottom_navigation