-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Labels
a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsVarious Google teamsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
This issue corresponds to Google internal issue b/204226713. It does not need additional triage.
The ToggleButtons height has been constrained to 32 but the input area has been padded, per MaterialTapTargetSIze.padded, to 48. The Toggle button has been wrapped in a green Container to highlight the input padding.
Code sample
import 'package:flutter/material.dart';
class Home extends StatefulWidget {
const Home({ Key? key }) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
int selectedTabIndex = 0;
@override
Widget build(BuildContext context) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
return Scaffold(
body: Center(
child: Container(
color: Colors.green.withOpacity(0.15),
child: ToggleButtons(
tapTargetSize: MaterialTapTargetSize.padded,
isSelected: [
selectedTabIndex == 0,
selectedTabIndex == 1,
],
onPressed: (int index) {
setState(() { selectedTabIndex = index; });
},
borderRadius: const BorderRadius.all(Radius.circular(8)),
selectedBorderColor: colorScheme.primary,
selectedColor: colorScheme.primary,
constraints: const BoxConstraints.tightFor(
width: 86,
height: 32,
),
children: [
Text('Locks'),
Text('Unlocks'),
],
),
),
),
);
}
}
void main() {
runApp(const MaterialApp(home: Home()));
}Metadata
Metadata
Assignees
Labels
a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsVarious Google teamsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Type
Projects
Status
Done (PR merged)