flutter_curved_tab_bar 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

flutter_curved_tab_bar #

A custom flutter tab bar.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - 29/10/2019 #

  • Package creation
  • Support for 4 custom tabs
  • Custom icons and colors for the tabs

[0.0.2] - 04/11/2019 #

  • Enabled use of 3 and 5 tabs
  • Example with 5 tabs

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_curved_tab_bar/flutter_curved_tab_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(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

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

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

  @override
  Widget build(BuildContext context) {
    final List<Widget> _screens = <Widget>[_screen0(), _screen1(), _screen2(), _screen3(), _screen4()];

    return SafeArea(
      child: Scaffold(
        body: Center(
          child: Column(
            children: <Widget> [
              CurvedTabBar(
                tabsColor: Colors.white,
                tabSelectedColor: Colors.blueAccent,
                iconSelectedColor: Colors.white,
                iconsColor: Colors.blue[200],
                numberOfTabs: 5,
                icons: [Icons.person_outline, Icons.widgets, Icons.bookmark, Icons.search, Icons.style],
                onTabSelected: (_index) {
                  setState(() {
                    _currentIndex = _index;
                  });
                }
              ),
              _screens[_currentIndex]
            ],
          ),
          )
      ),
    );
  }

  Widget _screen0() {
    return Container(
      height: MediaQuery.of(context).size.height - 73,
      color: Colors.white,
      child: Center(child: Text("Screen 0"))
    );
  }

  Widget _screen1() {
    return Container(
      height: MediaQuery.of(context).size.height - 73,
      color: Colors.white,
      child: Center(child: Text("Screen 1"))
    );
  }

  Widget _screen2() {
    return Container(
      height: MediaQuery.of(context).size.height - 73,
      color: Colors.white,
      child: Center(child: Text("Screen 2"))
    );
  }

  Widget _screen3() {
    return Container(
      height: MediaQuery.of(context).size.height - 73,
      color: Colors.white,
      child: Center(child: Text("Screen 3"))
    );
  }

  Widget _screen4() {
    return Container(
        height: MediaQuery.of(context).size.height - 73,
        color: Colors.white,
        child: Center(child: Text("Screen 4"))
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_curved_tab_bar: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_curved_tab_bar/flutter_curved_tab_bar.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
57
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/flutter_curved_tab_bar.dart. (-0.50 points)

Analysis of lib/flutter_curved_tab_bar.dart reported 1 hint:

line 3 col 8: Unused import: 'dart:math'.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test