mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

internal: b/317125569 If the text button label contains its role and state, it will be confusing for tester. it will be announced like "xxx button button" : <img src="https://github.com/flutter/flutter/assets/108393416/16f5a996-b0f1-4f04-bd99-caa3cacd4182" width=50% height=50%> updated screen and label: <img src="https://github.com/flutter/flutter/assets/108393416/1de55cec-8a18-4c36-9dac-84ae7d151fd6" width=50% height=50%>
68 lines
1.7 KiB
Dart
68 lines
1.7 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 TextButtonUseCase extends UseCase {
|
|
|
|
@override
|
|
String get name => 'TextButton';
|
|
|
|
@override
|
|
String get route => '/text-button';
|
|
|
|
@override
|
|
Widget build(BuildContext context) => const MainWidget();
|
|
}
|
|
|
|
class MainWidget extends StatefulWidget {
|
|
const MainWidget({super.key});
|
|
|
|
@override
|
|
State<MainWidget> createState() => MainWidgetState();
|
|
}
|
|
|
|
class MainWidgetState extends State<MainWidget> {
|
|
double currentSliderValue = 20;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
title: const Text('TextButton'),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
const Text('This is a TextButton:'),
|
|
TextButton(
|
|
onPressed: () { },
|
|
child: const Text('Action'),
|
|
),
|
|
],
|
|
),
|
|
const Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text('This is a disabled TextButton:'),
|
|
TextButton(
|
|
onPressed: null,
|
|
child: Text('Action'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|