Home > Software design >  Flutter mobile app dev- "the named parameter title' isn't defined. I have change it t
Flutter mobile app dev- "the named parameter title' isn't defined. I have change it t

Time:08-19

This is the code: Have changed title to label as below. But Text(....) was all highlighted in red. Error - "the argument type 'Text' can't be assigned to the parameter type 'String'."

    @override
 Widget build(BuildContext context) {
        var data = EasyLocalizationProvider.of(context).data;
  return EasyLocalizationProvider(
          data: data,
      child: Scaffold(
     body: callPage(currentIndex),
     bottomNavigationBar: Theme(
         data: Theme.of(context).copyWith(
             canvasColor: Colors.white,
             textTheme: Theme.of(context).textTheme.copyWith(
                 caption: TextStyle(color: Colors.black26.withOpacity(0.15)))),
         child: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          currentIndex: currentIndex,
          fixedColor: Color(0xFF6991C7),
          onTap: (value) {
           currentIndex = value;
           setState(() {});
          },
BottomNavigationBarItem(
               icon: Icon(Icons.shop),
               label: Text(
                 AppLocalizations.of(context).tr('Produce'),
                style: TextStyle(fontFamily: "Berlin", letterSpacing: 0.5),
               )),

enter image description here

CodePudding user response:

Check in the documentation, the label is a string? and not a widget. Link : https://api.flutter.dev/flutter/widgets/BottomNavigationBarItem-class.html So you have to change it like this:

label: AppLocalizations.of(context).tr('Produce')
  • Related