Closed ompadmani71 closed 1 year ago
import 'package:flutter/material.dart'; import 'package:awesome_bottom_bar/awesome_bottom_bar.dart';
class Salomon extends StatefulWidget { static const String routeName = '/product'; final List items;
const Salomon({ Key? key, required this.items, }) : super(key: key);
@override _SalomonState createState() => _SalomonState(); }
class _SalomonState extends State { int visit = 0;
@override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ const SizedBox(height: 87), Container(), BottomBarSalomon( items: widget.items, color: Colors.blue, backgroundColor: Colors.white, colorSelected: Colors.white, backgroundSelected: Colors.blue, indexSelected: visit, animated: false, onTap: (index) => setState(() { visit = index; }), ), ], ), bottomNavigationBar: BottomBarSalomon( items: widget.items, color: Colors.blue, backgroundColor: Colors.red.withOpacity(0.4), colorSelected: Colors.white, backgroundSelected: Colors.blue, indexSelected: visit, onTap: (index) => setState(() { visit = index; }), ), ); } }
And if I remove the const from 'C:\Users\LENOVO\AppData\Local\Pub\Cache\hosted\pub.dev\awesome_bottom_bar-1.2.3\lib\widgets\inspired\stack.dart' then it's give me another error
which is here
please give me a soluction for the same asap.
@ompadmani71 please add key in TabItem Ex: List items = [ TabItem( key: 'home', // Assign a unique key icon: Icons.home, title: 'Home', ), TabItem( key: 'tools', // Assign a unique key icon: Icons.add_chart_outlined, title: 'Tools', ), TabItem( key: 'activity', // Assign a unique key icon: Icons.add_business_sharp, title: 'Activity', ), ];
Thank you @Rimansh1464
@Rimansh1464 I provided the key in my tab items but still got the error. Any other solution I could use?
import 'package:flutter/material.dart'; import 'package:awesome_bottom_bar/awesome_bottom_bar.dart';
class Salomon extends StatefulWidget { static const String routeName = '/product'; final List items;
const Salomon({ Key? key, required this.items, }) : super(key: key);
@override _SalomonState createState() => _SalomonState(); }
class _SalomonState extends State {
int visit = 0;
@override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ const SizedBox(height: 87), Container(), BottomBarSalomon( items: widget.items, color: Colors.blue, backgroundColor: Colors.white, colorSelected: Colors.white, backgroundSelected: Colors.blue, indexSelected: visit, animated: false, onTap: (index) => setState(() { visit = index; }), ), ], ), bottomNavigationBar: BottomBarSalomon( items: widget.items, color: Colors.blue, backgroundColor: Colors.red.withOpacity(0.4), colorSelected: Colors.white, backgroundSelected: Colors.blue, indexSelected: visit, onTap: (index) => setState(() { visit = index; }), ), ); } }
==========================================================
And if I remove the const from 'C:\Users\LENOVO\AppData\Local\Pub\Cache\hosted\pub.dev\awesome_bottom_bar-1.2.3\lib\widgets\inspired\stack.dart' then it's give me another error
which is here
please give me a soluction for the same asap.