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

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(
        width: double.infinity,
        height: 700,
        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: Container(
                width: 100,
                height: 50,
                decoration: new BoxDecoration(
                  color: Colors.blue,
                
                ),
                child: Icon(
                  NeosIcons.courses,
                  size: 50.0,
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }

  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: "Direc",
          ),
          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
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

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