如何在颤振中实现这一结果?

问题描述

enter image description here

每当在Flutter中选择一个标签时,如何显示该缺口? 以及如何通过每当选择另一个标签具有槽口滑动动画改变?

谢谢您的帮助

解决方法

这是我可以做的解决方法: 导入'package:flutter / material.dart';

void main() => runApp(MyApp());

/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,home: MyStatefulWidget(),);
  }
}

class MyStatefulWidget extends StatefulWidget {
  MyStatefulWidget({Key key}) : super(key: key);

  @override
  _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}

class _MyStatefulWidgetState extends State<MyStatefulWidget> {
  int _selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Row(
        children: <Widget>[
          NavigationRail(
            selectedIndex: _selectedIndex,onDestinationSelected: (int index) {
              setState(() {
                _selectedIndex = index;
              });
            },labelType: NavigationRailLabelType.selected,destinations: [
              NavigationRailDestination(
                icon: Text("Food"),label: Container(
                    width: 8,height: 8,decoration: BoxDecoration(
                      color: Colors.red,shape: BoxShape.circle,)),),NavigationRailDestination(
                icon: Text("Bakery"),NavigationRailDestination(
                icon: Text("Drinks"),],VerticalDivider(thickness: 1,width: 1),// This is the main content.
          Expanded(
            child: Center(
              child: Text(
                'selectedIndex: $_selectedIndex',style: Theme.of(context).textTheme.headline4,)
        ],);
  }
}

您可以将NavigationRail用于侧边栏。但是我不确定如何进行切槽,无论如何我希望这可以对您有所帮助

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...