flutter_navigation_bar 0.0.4 copy "flutter_navigation_bar: ^0.0.4" to clipboard
flutter_navigation_bar: ^0.0.4 copied to clipboard

outdated

A Flutter Android Navigation Bar plugin.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:flutter_navigation_bar/flutter_navigation_bar.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  bool _autovalidate = false;

  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();

  void _incrementCounter() {
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle.dark.copyWith(
        statusBarColor: Colors.transparent, //bgBlue, // Background color for status bar
//        statusBarBrightness: Brightness.light, // Dark == white status bar.
        statusBarBrightness: Brightness.dark, // Dark == white status bar.
//        systemNavigationBarColor: Colors.transparent,
        systemNavigationBarColor: Color(0x5F986ECA),
      ),
    );

    FlutterNavigationBar.getNavigationBarHeight().then((result) {
//      print('NavigationBarHeight = '+result.height.toString()+', '+result.width.toString());
      print('NavigationBarHeight = $result');
//      FlutterNavigationBar.setNavigationBarTransparent();
    });


    setState(() {
      _counter++;
    });
  }

  void _decrementCounter() {
//    SystemChrome.setSystemUIOverlayStyle(
//      SystemUiOverlayStyle.dark.copyWith(
//        statusBarColor: Colors.transparent, //bgBlue, // Background color for status bar
////        statusBarBrightness: Brightness.light, // Dark == white status bar.
//        statusBarBrightness: Brightness.dark, // Dark == white status bar.
////        systemNavigationBarColor: Colors.transparent,
//        systemNavigationBarColor: Color(0x5F986ECA),
//      ),
//    );

    FlutterNavigationBar.setNavigationBarTransparent();


    setState(() {
      _counter--;
    });
  }

  void _star() {
//    SystemChrome.setSystemUIOverlayStyle(
//      SystemUiOverlayStyle.dark.copyWith(
//        statusBarColor: Colors.transparent, //bgBlue, // Background color for status bar
////        statusBarBrightness: Brightness.light, // Dark == white status bar.
//        statusBarBrightness: Brightness.dark, // Dark == white status bar.
////        systemNavigationBarColor: Colors.transparent,
//        systemNavigationBarColor: Color(0x5F986ECA),
//      ),
//    );

//    FlutterNavigationBar.setNavigationBarTransparent();
//    SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
//    SystemChrome.setEnabledSystemUIOverlays([]);
    SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);

    setState(() {
      _counter = 0;
    });
  }


  @override
  Widget build(BuildContext context) {
//    FlutterNavigationBar.setNavigationBarTransparent();

//    SystemChrome.setSystemUIOverlayStyle(
//      SystemUiOverlayStyle.light.copyWith(
////        statusBarColor: Colors.transparent,//bgBlue, // Background color for status bar
//        statusBarColor: Colors.green, // Background color for status bar
////        statusBarColor: Color(0x5F986ECA),//bgBlue, // Background color for status bar
////        statusBarBrightness: Brightness.light, // Dark == white status bar.
////        statusBarBrightness: Brightness.dark, // Dark == white status bar.
////        systemNavigationBarColor: Colors.transparent,
//        systemNavigationBarColor: Colors.green,
////        systemNavigationBarColor: Color(0x5F986ECA),
////        systemNavigationBarDividerColor: Colors.red,
//      ),
//    );

//    FlutterNavigationBar.setNavigationBarTransparent();

//    return Container(
//      color: Colors.blue,
//      child: Padding(
////        padding: const EdgeInsets.fromLTRB(0, 46, 0, 46),
//        padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
//        child: Scaffold(
//          backgroundColor: Colors.white,
//          appBar: AppBar(
//            title: Text(widget.title),
//          ),
//          body: Center(
//            child: Column(
//              mainAxisAlignment: MainAxisAlignment.center,
//              children: <Widget>[
//                Text(
//                  'You have pushed the button this many times:',
//                ),
//                Text(
//                  '$_counter',
//                  style: Theme.of(context).textTheme.display1,
//                ),
//                Form(
//                  key: _formKey,
//                  autovalidate: _autovalidate,
////          onWillPop: _warnUserAboutInvalidData,
//                  child: SingleChildScrollView(
////            dragStartBehavior: DragStartBehavior.down,
//                    padding: const EdgeInsets.symmetric(horizontal: 16.0),
//                    child: Column(
//                      crossAxisAlignment: CrossAxisAlignment.stretch,
//                      children: <Widget>[
//                        const SizedBox(height: 24.0),
//                        TextFormField(
//                          textCapitalization: TextCapitalization.words,
//                          decoration: const InputDecoration(
//                            border: UnderlineInputBorder(),
//                            filled: true,
//                            icon: Icon(Icons.person),
//                            hintText: 'What do people call you?',
//                            labelText: 'Name *',
//                          ),
////                  onSaved: (String value) { person.name = value; },
////                  validator: _validateName,
//                        ),
//                        const SizedBox(height: 24.0),
//                        TextFormField(
//                          decoration: const InputDecoration(
//                            border: UnderlineInputBorder(),
//                            filled: true,
//                            icon: Icon(Icons.phone),
//                            hintText: 'Where can we reach you?',
//                            labelText: 'Phone Number *',
//                            prefixText: '+1',
//                          ),
//                          keyboardType: TextInputType.phone,
////                  onSaved: (String value) { person.phoneNumber = value; },
////                  validator: _validatePhoneNumber,
//                          // TextInputFormatters are applied in sequence.
////                  inputFormatters: <TextInputFormatter> [
////                    WhitelistingTextInputFormatter.digitsOnly,
////                    // Fit the validating format.
////                    _phoneNumberFormatter,
////                  ],
//                        ),
//                        const SizedBox(height: 24.0),
//                        TextFormField(
//                          decoration: const InputDecoration(
//                            border: UnderlineInputBorder(),
//                            filled: true,
//                            icon: Icon(Icons.email),
//                            hintText: 'Your email address',
//                            labelText: 'E-mail',
//                          ),
//                          keyboardType: TextInputType.emailAddress,
////                  onSaved: (String value) { person.email = value; },
//                        ),
//                        const SizedBox(height: 24.0),
//                        TextFormField(
//                          decoration: const InputDecoration(
//                            border: OutlineInputBorder(),
//                            hintText: 'Tell us about yourself (e.g., write down what you do or what hobbies you have)',
//                            helperText: 'Keep it short, this is just a demo.',
//                            labelText: 'Life story',
//                          ),
//                          maxLines: 3,
//                        ),
//                        const SizedBox(height: 24.0),
//                        TextFormField(
//                          keyboardType: TextInputType.number,
//                          decoration: const InputDecoration(
//                            border: OutlineInputBorder(),
//                            labelText: 'Salary',
//                            prefixText: '\$',
//                            suffixText: 'USD',
//                            suffixStyle: TextStyle(color: Colors.green),
//                          ),
//                          maxLines: 1,
//                        ),
//                        const SizedBox(height: 24.0),
////                PasswordField(
////                  fieldKey: _passwordFieldKey,
////                  helperText: 'No more than 8 characters.',
////                  labelText: 'Password *',
////                  onFieldSubmitted: (String value) {
////                    setState(() {
//////                      person.password = value;
////                    });
////                  },
////                ),
//                        const SizedBox(height: 24.0),
//                        TextFormField(
////                  enabled: person.password != null && person.password.isNotEmpty,
//                          decoration: const InputDecoration(
//                            border: UnderlineInputBorder(),
//                            filled: true,
//                            labelText: 'Re-type password',
//                          ),
//                          maxLength: 8,
//                          obscureText: true,
////                  validator: _validatePassword,
//                        ),
//                        const SizedBox(height: 24.0),
//                        Center(
//                          child: RaisedButton(
//                            child: const Text('SUBMIT'),
////                            onPressed: {},
//                          ),
//                        ),
//                        const SizedBox(height: 24.0),
//                        Text(
//                          '* indicates required field',
//                          style: Theme.of(context).textTheme.caption,
//                        ),
//                        const SizedBox(height: 24.0),
//                      ],
//                    ),
//                  ),
//                ),
//              ],
//            ),
//          ),
//          floatingActionButton: FloatingActionButton(
//            onPressed: _incrementCounter,
//            tooltip: 'Increment',
//            child: Icon(Icons.add),
//          ),
//        ),
//      ),
//    );

    return Scaffold(
      backgroundColor: Colors.white,
      extendBody: true,

      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Form(
        key: _formKey,
        autovalidate: _autovalidate,
//          onWillPop: _warnUserAboutInvalidData,
        child: SingleChildScrollView(
//            dragStartBehavior: DragStartBehavior.down,
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              const SizedBox(height: 24.0),
              TextFormField(
                textCapitalization: TextCapitalization.words,
                decoration: const InputDecoration(
                  border: UnderlineInputBorder(),
                  filled: true,
                  icon: Icon(Icons.person),
                  hintText: 'What do people call you?',
                  labelText: 'Name *',
                ),
//                  onSaved: (String value) { person.name = value; },
//                  validator: _validateName,
              ),
              const SizedBox(height: 24.0),
              TextFormField(
                decoration: const InputDecoration(
                  border: UnderlineInputBorder(),
                  filled: true,
                  icon: Icon(Icons.phone),
                  hintText: 'Where can we reach you?',
                  labelText: 'Phone Number *',
                  prefixText: '+1',
                ),
                keyboardType: TextInputType.phone,
//                  onSaved: (String value) { person.phoneNumber = value; },
//                  validator: _validatePhoneNumber,
                // TextInputFormatters are applied in sequence.
//                  inputFormatters: <TextInputFormatter> [
//                    WhitelistingTextInputFormatter.digitsOnly,
//                    // Fit the validating format.
//                    _phoneNumberFormatter,
//                  ],
              ),
              const SizedBox(height: 24.0),
              TextFormField(
                decoration: const InputDecoration(
                  border: UnderlineInputBorder(),
                  filled: true,
                  icon: Icon(Icons.email),
                  hintText: 'Your email address',
                  labelText: 'E-mail',
                ),
                keyboardType: TextInputType.emailAddress,
//                  onSaved: (String value) { person.email = value; },
              ),
              const SizedBox(height: 24.0),
              TextFormField(
                decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  hintText: 'Tell us about yourself (e.g., write down what you do or what hobbies you have)',
                  helperText: 'Keep it short, this is just a demo.',
                  labelText: 'Life story',
                ),
                maxLines: 3,
              ),
              const SizedBox(height: 24.0),
              TextFormField(
                keyboardType: TextInputType.number,
                decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'Salary',
                  prefixText: '\$',
                  suffixText: 'USD',
                  suffixStyle: TextStyle(color: Colors.green),
                ),
                maxLines: 1,
              ),
              const SizedBox(height: 24.0),
//                PasswordField(
//                  fieldKey: _passwordFieldKey,
//                  helperText: 'No more than 8 characters.',
//                  labelText: 'Password *',
//                  onFieldSubmitted: (String value) {
//                    setState(() {
////                      person.password = value;
//                    });
//                  },
//                ),
              const SizedBox(height: 24.0),
              TextFormField(
//                  enabled: person.password != null && person.password.isNotEmpty,
                decoration: const InputDecoration(
                  border: UnderlineInputBorder(),
                  filled: true,
                  labelText: 'Re-type password',
                ),
                maxLength: 8,
                obscureText: true,
//                  validator: _validatePassword,
              ),
              const SizedBox(height: 24.0),
              Center(
                child: RaisedButton(
                  child: const Text('SUBMIT'),
//                            onPressed: {},
                ),
              ),
              const SizedBox(height: 24.0),
              Text(
                '* indicates required field',
                style: Theme
                    .of(context)
                    .textTheme
                    .caption,
              ),
              const SizedBox(height: 24.0),
            ],
          ),
        ),
      ),
      floatingActionButton: Row(
        children: <Widget>[
          FloatingActionButton(
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: Icon(Icons.add),
          ),
          FloatingActionButton(
            onPressed: _decrementCounter,
            tooltip: 'Decrement',
            child: Icon(Icons.remove),
          ),
          FloatingActionButton(
            onPressed: _star,
            tooltip: 'star',
            child: Icon(Icons.star),
          ),

        ]
      )

    );

//    return Container(
//      color: Colors.red,
//      child: Text(
//        'Hello',
//        textScaleFactor: 1,
//        style: TextStyle(color: Colors.blue),
//      ),
//    );
  }
}


//import 'package:flutter/material.dart';
//import 'dart:async';
//
//import 'package:flutter/services.dart';
//import 'package:flutter_navigation_bar/flutter_navigation_bar.dart';
//
//void main() => runApp(MyApp());
//
//class MyApp extends StatefulWidget {
//  @override
//  _MyAppState createState() => _MyAppState();
//}
//
//class _MyAppState extends State<MyApp> {
//  String _platformVersion = 'Unknown';
//
//  int _counter = 0;
//  bool _autovalidate = false;
//  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
//
//  @override
//  void initState() {
//    super.initState();
//    initPlatformState();
//  }
//
//  // Platform messages are asynchronous, so we initialize in an async method.
//  Future<void> initPlatformState() async {
//    String platformVersion;
//    // Platform messages may fail, so we use a try/catch PlatformException.
//    try {
//      await FlutterNavigationBar.setNavigationBarTransparent();
//
//      platformVersion = await FlutterNavigationBar.platformVersion;
//    } on PlatformException {
//      platformVersion = 'Failed to get platform version.';
//    }
//
//
//    // If the widget was removed from the tree while the asynchronous platform
//    // message was in flight, we want to discard the reply rather than calling
//    // setState to update our non-existent appearance.
//    if (!mounted) return;
//
//    setState(() {
//      _platformVersion = platformVersion;
//    });
//  }
//
//
//  void _incrementCounter() {
////    SystemChrome.setSystemUIOverlayStyle(
////      SystemUiOverlayStyle.dark.copyWith(
////        statusBarColor: Colors.transparent, //bgBlue, // Background color for status bar
//////        statusBarBrightness: Brightness.light, // Dark == white status bar.
////        statusBarBrightness: Brightness.dark, // Dark == white status bar.
//////        systemNavigationBarColor: Colors.transparent,
////        systemNavigationBarColor: Color(0x5F986ECA),
////      ),
////    );
//
//    FlutterNavigationBar.setNavigationBarTransparent();
//
//    setState(() {
//      _counter++;
//    });
//  }
//
//  @override
//  Widget build(BuildContext context) {
//
////    SystemChrome.setSystemUIOverlayStyle(
////      SystemUiOverlayStyle.dark.copyWith(
////        statusBarColor: Colors.transparent,//bgBlue, // Background color for status bar
////        statusBarBrightness: Brightness.dark, // Dark == white status bar.
////        systemNavigationBarColor: Colors.transparent,
//////        systemNavigationBarColor: Color(0xFF986ECA),
////      ),
////    );
//
////    FlutterNavigationBar.setNavigationBarTransparent();
//
////    return MaterialApp(
////      home: Scaffold(
////
////        extendBody: true,
////        primary: true,
////        backgroundColor: Color(0xFF186ECA),
////        resizeToAvoidBottomInset: true,
////
////        appBar: AppBar(
////          title: const Text('Plugin example app'),
////        ),
////        body: Center(
////          child: Text('Running on: $_platformVersion\n'),
////        ),
////        bottomNavigationBar: Text('Hello'),
////      ),
////    );
//
//    return MaterialApp(
//      home: Scaffold(
//      backgroundColor: Colors.white,
//      appBar: AppBar(
//        title: Text(widget.title),
//      ),
//      body: Form(
//        key: _formKey,
//        autovalidate: _autovalidate,
////          onWillPop: _warnUserAboutInvalidData,
//        child: SingleChildScrollView(
////            dragStartBehavior: DragStartBehavior.down,
//          padding: const EdgeInsets.symmetric(horizontal: 16.0),
//          child: Column(
//            crossAxisAlignment: CrossAxisAlignment.stretch,
//            children: <Widget>[
//              const SizedBox(height: 24.0),
//              TextFormField(
//                textCapitalization: TextCapitalization.words,
//                decoration: const InputDecoration(
//                  border: UnderlineInputBorder(),
//                  filled: true,
//                  icon: Icon(Icons.person),
//                  hintText: 'What do people call you?',
//                  labelText: 'Name *',
//                ),
////                  onSaved: (String value) { person.name = value; },
////                  validator: _validateName,
//              ),
//              const SizedBox(height: 24.0),
//              TextFormField(
//                decoration: const InputDecoration(
//                  border: UnderlineInputBorder(),
//                  filled: true,
//                  icon: Icon(Icons.phone),
//                  hintText: 'Where can we reach you?',
//                  labelText: 'Phone Number *',
//                  prefixText: '+1',
//                ),
//                keyboardType: TextInputType.phone,
////                  onSaved: (String value) { person.phoneNumber = value; },
////                  validator: _validatePhoneNumber,
//                // TextInputFormatters are applied in sequence.
////                  inputFormatters: <TextInputFormatter> [
////                    WhitelistingTextInputFormatter.digitsOnly,
////                    // Fit the validating format.
////                    _phoneNumberFormatter,
////                  ],
//              ),
//              const SizedBox(height: 24.0),
//              TextFormField(
//                decoration: const InputDecoration(
//                  border: UnderlineInputBorder(),
//                  filled: true,
//                  icon: Icon(Icons.email),
//                  hintText: 'Your email address',
//                  labelText: 'E-mail',
//                ),
//                keyboardType: TextInputType.emailAddress,
////                  onSaved: (String value) { person.email = value; },
//              ),
//              const SizedBox(height: 24.0),
//              TextFormField(
//                decoration: const InputDecoration(
//                  border: OutlineInputBorder(),
//                  hintText: 'Tell us about yourself (e.g., write down what you do or what hobbies you have)',
//                  helperText: 'Keep it short, this is just a demo.',
//                  labelText: 'Life story',
//                ),
//                maxLines: 3,
//              ),
//              const SizedBox(height: 24.0),
//              TextFormField(
//                keyboardType: TextInputType.number,
//                decoration: const InputDecoration(
//                  border: OutlineInputBorder(),
//                  labelText: 'Salary',
//                  prefixText: '\$',
//                  suffixText: 'USD',
//                  suffixStyle: TextStyle(color: Colors.green),
//                ),
//                maxLines: 1,
//              ),
//              const SizedBox(height: 24.0),
////                PasswordField(
////                  fieldKey: _passwordFieldKey,
////                  helperText: 'No more than 8 characters.',
////                  labelText: 'Password *',
////                  onFieldSubmitted: (String value) {
////                    setState(() {
//////                      person.password = value;
////                    });
////                  },
////                ),
//              const SizedBox(height: 24.0),
//              TextFormField(
////                  enabled: person.password != null && person.password.isNotEmpty,
//                decoration: const InputDecoration(
//                  border: UnderlineInputBorder(),
//                  filled: true,
//                  labelText: 'Re-type password',
//                ),
//                maxLength: 8,
//                obscureText: true,
////                  validator: _validatePassword,
//              ),
//              const SizedBox(height: 24.0),
//              Center(
//                child: RaisedButton(
//                  child: const Text('SUBMIT'),
////                            onPressed: {},
//                ),
//              ),
//              const SizedBox(height: 24.0),
//              Text(
//                '* indicates required field',
//                style: Theme.of(context).textTheme.caption,
//              ),
//              const SizedBox(height: 24.0),
//            ],
//          ),
//        ),
//      ),
//      floatingActionButton: FloatingActionButton(
//        onPressed: _incrementCounter,
//        tooltip: 'Increment',
//        child: Icon(Icons.add),
//      ),
//    );
//
//  }
//}
0
likes
0
pub points
47%
popularity

Publisher

unverified uploader

A Flutter Android Navigation Bar plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_navigation_bar