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

A reusable Flutter UI kit created by the Flutter Kanpur community, offering customizable widgets such as bottom navigation bars, SVG-based icons, and shared UI utilities for building modern apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_kanpur_ui_kit/flutter_kanpur_ui_kit.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    // Initialize ScreenUtil for responsive design
    return ScreenUtilInit(
      designSize: const Size(360, 690),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (_, child) {
        return MaterialApp(
          title: 'Flutter Kanpur UI Kit Example',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          home: child,
        );
      },
      child: const MyHomePage(title: 'Flutter Kanpur UI Kit Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              'Selected Index: $_currentIndex',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
            const SizedBox(height: 20),
            Text(
              _getPageName(_currentIndex),
              style: Theme.of(context).textTheme.titleLarge,
            ),
          ],
        ),
      ),
      // Use the BottomNavbar from the package
      bottomNavigationBar: BottomNavbar(
        currentIndex: _currentIndex,
        onTap: (index) {
          setState(() {
            _currentIndex = index;
          });
        },
      ),
    );
  }

  String _getPageName(int index) {
    switch (index) {
      case 0:
        return 'Home';
      case 1:
        return 'Search';
      case 2:
        return 'Create';
      case 3:
        return 'Trending';
      case 4:
        return 'Profile';
      default:
        return 'Unknown';
    }
  }
}
4
likes
0
points
250
downloads

Publisher

verified publisherflutterkanpur.in

Weekly Downloads

A reusable Flutter UI kit created by the Flutter Kanpur community, offering customizable widgets such as bottom navigation bars, SVG-based icons, and shared UI utilities for building modern apps.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_screenutil, flutter_svg, google_fonts

More

Packages that depend on flutter_kanpur_ui_kit