Skip to content
Snippets Groups Projects
Select Git revision
  • 593b58a00405509833bd280369d402f50adc17a2
  • master default protected
  • 84-improve-app-metadata
  • 82-fix-colors
  • 23-add-timer
  • 65-update-icons
  • Release_0.10.1_88 protected
  • Release_0.10.0_87 protected
  • Release_0.9.2_86 protected
  • Release_0.9.1_85 protected
  • Release_0.9.0_84 protected
  • Release_0.8.0_83 protected
  • Release_0.7.0_82 protected
  • Release_0.6.0_81 protected
  • Release_0.5.2_80 protected
  • Release_0.5.1_79 protected
  • Release_0.5.0_78 protected
  • Release_0.4.1_77 protected
  • Release_0.4.0_76 protected
  • Release_0.3.1_75 protected
  • Release_0.3.0_74 protected
  • Release_0.2.1_73 protected
  • Release_0.2.0_72 protected
  • Release_0.1.22_71 protected
  • Release_0.1.21_70 protected
  • Release_0.1.20_69 protected
26 results

parameters.dart

Blame
  • bottom_nav_bar.dart 2.52 KiB
    import 'package:easy_localization/easy_localization.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_bloc/flutter_bloc.dart';
    import 'package:flutter_swipe/flutter_swipe.dart';
    import 'package:unicons/unicons.dart';
    
    import 'package:random/cubit/bottom_nav_cubit.dart';
    
    class BottomNavBar extends StatelessWidget {
      const BottomNavBar({super.key, required this.swipeController});
    
      final SwiperController swipeController;
    
      @override
      Widget build(BuildContext context) {
        return Card(
          margin: const EdgeInsets.only(
            top: 1,
            right: 0,
            left: 0,
          ),
          elevation: 4,
          shadowColor: Theme.of(context).colorScheme.shadow,
          color: Theme.of(context).colorScheme.surfaceVariant,
          shape: const RoundedRectangleBorder(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(16),
              topRight: Radius.circular(16),
            ),
          ),
          child: BlocBuilder<BottomNavCubit, int>(
            builder: (BuildContext context, int state) {
              return BottomNavigationBar(
                currentIndex: state,
                onTap: (int index) {
                  context.read<BottomNavCubit>().updateIndex(index);
                  swipeController.move(index);
                },
                type: BottomNavigationBarType.fixed,
                elevation: 0,
                backgroundColor: Colors.transparent,
                selectedItemColor: Theme.of(context).colorScheme.primary,
                unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color,
                items: <BottomNavigationBarItem>[
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.image),
                    label: tr('bottom_nav_sample'),
                  ),
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.globe),
                    label: tr('bottom_nav_api'),
                  ),
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.pen),
                    label: tr('bottom_nav_chart'),
                  ),
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.star),
                    label: tr('bottom_nav_game'),
                  ),
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.setting),
                    label: tr('bottom_nav_settings'),
                  ),
                  BottomNavigationBarItem(
                    icon: const Icon(UniconsLine.info_circle),
                    label: tr('bottom_nav_about'),
                  ),
                ],
              );