赞
踩
我们都以某种方式使用过选项卡栏。但我们在与国家打交道时一般不会将它们联系起来。
在这篇适合初学者的文章中,我将向您展示如何在导航回屏幕后保留Flutter 中选项卡栏的状态。
import 'package:flutter/material.dart'; void main() { runApp(const TabBarDemo()); } class TabBarDemo extends StatelessWidget { const TabBarDemo({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: DefaultTabController( length: 3, child: Scaffold( appBar: AppBar( bottom: const TabBar( tabs: [ Tab(icon: Icon(Icons.directions_car)), Tab(icon: Icon(Icons.directions_transit)), Tab(icon: Icon(Icons.directions_bike)), ], ), title: const Text('Tabs Demo'), ), body: const TabBarView( children: [ Icon(Icons.directio
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。