| // 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 '../utils.dart'; |
| import 'use_cases.dart'; |
| |
| class IconButtonUseCase extends UseCase { |
| IconButtonUseCase(); |
| |
| @override |
| String get name => 'IconButton'; |
| |
| @override |
| String get route => '/icon-button'; |
| |
| @override |
| List<Tag> get tags => <Tag>[Tag.batch2, Tag.core]; |
| |
| @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> { |
| String pageTitle = getUseCaseName(IconButtonUseCase()); |
| |
| @override |
| Widget build(BuildContext context) { |
| return Scaffold( |
| appBar: AppBar(title: Semantics(headingLevel: 1, child: Text('$pageTitle Demo'))), |
| body: Center( |
| child: Column( |
| mainAxisAlignment: MainAxisAlignment.center, |
| children: <Widget>[ |
| IconButton( |
| icon: const Icon(Icons.volume_up), |
| tooltip: 'Increase volume', |
| onPressed: () {}, |
| ), |
| const IconButton( |
| icon: Icon(Icons.volume_up), |
| tooltip: 'Increase volume', |
| onPressed: null, // Disabled |
| ), |
| ], |
| ), |
| ), |
| ); |
| } |
| } |