Flutter —— TabBarView每次进入都刷新?

turboksFlutter91
import 'package:flutter/material.dart';

class PageOne extends StatefulWidget {
const PageOne({Key? key}) : super(key: key);

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

class _PageOneState extends State<PageOne> with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;

@override
void initState() {
    super.initState();
    print("pageone");
}

@override
Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
        body: Center(
        child: Text("pageone"),
        ),
        );
    }
}


相关文章

Flutter —— 使用RGB颜色

Flutter —— 使用RGB颜色

import 'dart:ui';extension HexColor on Color {  /// String is in the format "aabbc...

Flutter —— 网络请求

Flutter —— 网络请求

1.pubspec.yamldio: ^3.0.9 #网络请求2.使用    var url = "urlurlurlurlurl";   ...

Flutter —— 路由

Flutter —— 路由

1. pubspec.yamlfluro: ^1.5.1 #路由2. 路由管理中心    // ignore: import_of_legacy_library...

Flutter —— 原生交互

Flutter —— 原生交互

一:传递数据flutter:var methodChannel = const MethodChannel("ksapp");onPressed: () {// sendToAnd...

Flutter —— 左右切换视图

Flutter —— 左右切换视图

import 'package:flutter/material.dart';import 'package:ks/pageone.dart';import '...

Flutter —— 轮播图

Flutter —— 轮播图

1.pubspec.yaml  flutter_swiper: ^1.1.6 # 轮播图2.自定义一个类import 'package:flutter/material.dart&#...