improve focus example (#147464)

Part of #130459. Adds a test to the [second focus example](https://api.flutter.dev/flutter/widgets/Focus-class.html#widgets.Focus.2) and makes the function of the example more clear.
This commit is contained in:
derdilla
2024-05-07 22:07:49 +02:00
committed by GitHub
parent be3e916443
commit a7bdf369e5
3 changed files with 101 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ class FocusableText extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(8.0),
// Change the color based on whether or not this Container has focus.
color: Focus.of(context).hasPrimaryFocus ? Colors.black12 : null,
color: Focus.of(context).hasPrimaryFocus ? Colors.red : Colors.white,
child: Text(data),
);
}),