2

When i try to change TextStyle it says "The argument type 'Text' can't be assigned to the parameter type 'String'." How can i change it?

  1. I am using convex_bottom_bar 3.0.0
  2. Sorry for my english if i made mistake
 bottomNavigationBar: ConvexAppBar(
          items: [
            TabItem(icon: Icons.touch_app_rounded, title: Text("Tab1",style: TextStyle(fontFamily: "iransans"),)),
            TabItem(icon: Icons.store_rounded, title: 'Mağaza'),
            TabItem(icon: Icons.developer_board_rounded, title: 'Simülasyon'),
            TabItem(icon: Icons.timeline_rounded, title: 'İstatistik'),
            TabItem(icon: Icons.view_week_rounded, title: 'Diğer'),
          ],
          gradient: LinearGradient(
            colors: [Color(0xFFEC407A),
              Color(0XFF1A237E)],
            begin: Alignment.bottomCenter,
            stops: [
              0.0,0.4
            ],
            end: Alignment.topCenter,
          ),
          height: 70,
          backgroundColor: Color(0xFFEC407A),
          //backgroundColor: Colors.white,
          activeColor: Colors.white,
          initialActiveIndex: 0,//optional, default as 0
          onTap: (int i) => print('click index=$i'),
        ),

1 Answers1

7
//Don't use Text () and use the StyleProvider Widget in your bottomNavigationBar. In 
//TextStyle add fontFamily.

bottomNavigationBar: StyleProvider(    
  style: Style(),
  child: ConvexAppBar(
    initialActiveIndex: 1,
    height: 50,
    top: -30,
    curveSize: 100,
    style: TabStyle.fixedCircle,
    items: [
      TabItem(icon: Icons.link),
      TabItem(icon: Icons.import_contacts),
      TabItem(title: "2020", icon: Icons.work),
    ],
    backgroundColor: _tabBackgroundColor,
  ),
)
class Style extends StyleHook {
  @override
  double get activeIconSize => 40;

  @override
  double get activeIconMargin => 10;

  @override
  double get iconSize => 20;

  @override
  TextStyle textStyle(Color color) {
    return TextStyle(fontSize: 20, color: color);
  }
}
Fernando Lozada
  • 287
  • 3
  • 4