hangyu 454908185f
Add app bar and tab bar to a11y assessment app (#152904)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-08-23 17:57:04 +00:00

67 lines
1.6 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'use_cases.dart';
class TabBarViewUseCase extends UseCase {
@override
String get name => 'TabBarView';
@override
String get route => '/tab-bar-view';
@override
Widget build(BuildContext context) => const TabBarViewExample();
}
class TabBarViewExample extends StatelessWidget {
const TabBarViewExample({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
initialIndex: 1,
length: 3,
child: Scaffold(
appBar: AppBar(
title: Semantics(headingLevel: 1, child: const Text('TabBarView Sample')),
bottom: const TabBar(
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
text: 'Cloudy',
),
Tab(
icon: Icon(Icons.beach_access_sharp),
text: 'Rainy',
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
text: 'Sunny',
),
],
),
),
body: const TabBarView(
children: <Widget>[
Center(
child: Text("It's cloudy here"),
),
Center(
child: Text("It's rainy here"),
),
Center(
child: Text("It's sunny here"),
),
],
),
),
);
}
}