sliding_clipped_nav_bar 1.0.0+2 copy "sliding_clipped_nav_bar: ^1.0.0+2" to clipboard
sliding_clipped_nav_bar: ^1.0.0+2 copied to clipboard

outdated

Bottom Navigation Bar with sliding menu icon and text with clipping effect, also ripple effect when tapped.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:sliding_clipped_nav_bar/sliding_clipped_nav_bar.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: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late PageController controller;
  int selectedIndex = 0;

  @override
  void initState() {
    super.initState();
    controller = PageController(initialPage: selectedIndex);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: PageView(
        controller: controller,
        children: [
          Center(
            child: Icon(
              Icons.event,
              size: 56,
              color: Colors.amber,
            ),
          ),
          Center(
            child: Icon(
              Icons.search_rounded,
              size: 56,
              color: Colors.amber,
            ),
          ),
          Center(
            child: Icon(
              Icons.bolt_rounded,
              size: 56,
              color: Colors.amber,
            ),
          ),
          Center(
            child: Icon(
              Icons.tune_rounded,
              size: 56,
              color: Colors.amber,
            ),
          ),
        ],
      ),
      bottomNavigationBar: SlidingClippedNavBar(
        backgroundColor: Colors.white,
        onButtonPressed: (index) {
          setState(() {
            selectedIndex = index;
          });
          controller.animateToPage(selectedIndex,
              duration: const Duration(milliseconds: 400),
              curve: Curves.easeOutQuad);
        },
        iconSize: 30,
        // 24 should be okay
        activeColor: Colors.blue[900]!,
        selectedIndex: selectedIndex,
        barItems: [
          BarItem(
            icon: Icons.event,
            title: 'Events',
          ),
          BarItem(
            icon: Icons.search_rounded,
            title: 'Search',
          ),
          BarItem(
            icon: Icons.bolt_rounded,
            title: 'Energy',
          ),
          BarItem(
            icon: Icons.tune_rounded,
            title: 'Settings',
          ),
        ],
      ),
    );
  }
}

// icon size:24 for fontAwesomeIcons
// icons size: 30 for MaterialIcons
296
likes
0
pub points
93%
popularity

Publisher

verified publisherwaterydesert.com

Bottom Navigation Bar with sliding menu icon and text with clipping effect, also ripple effect when tapped.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on sliding_clipped_nav_bar