1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-19 05:22:16 +00:00
This commit is contained in:
Brett Morgan
2022-05-11 12:48:11 -07:00
committed by GitHub
parent fb00d0a102
commit ccd68f34e2
242 changed files with 1719 additions and 1430 deletions

View File

@@ -255,7 +255,7 @@ class DetailsScreen extends StatefulWidget {
}
@override
_DetailsScreenState createState() => _DetailsScreenState();
State<DetailsScreen> createState() => _DetailsScreenState();
}
class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin {

View File

@@ -15,7 +15,7 @@ class SearchScreen extends StatefulWidget {
final String? restorationId;
@override
_SearchScreenState createState() => _SearchScreenState();
State<SearchScreen> createState() => _SearchScreenState();
}
class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
@@ -76,11 +76,14 @@ class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
// This invisible and otherwise unnecessary search box is used to
// pad the list entries downward, so none will be underneath the
// real search box when the list is at its top scroll position.
child: _createSearchBox(focus: false),
visible: false,
maintainSize: true,
maintainAnimation: true,
maintainState: true,
// This invisible and otherwise unnecessary search box is used to
// pad the list entries downward, so none will be underneath the
// real search box when the list is at its top scroll position.
child: _createSearchBox(focus: false),
);
} else {
return Padding(

View File

@@ -166,11 +166,16 @@ class CalorieSettingsScreen extends StatelessWidget {
}
}
class SettingsScreen extends StatelessWidget {
class SettingsScreen extends StatefulWidget {
const SettingsScreen({this.restorationId, Key? key}) : super(key: key);
final String? restorationId;
@override
State<SettingsScreen> createState() => _SettingsScreenState();
}
class _SettingsScreenState extends State<SettingsScreen> {
SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) {
return SettingsItem(
label: 'Calorie Target',
@@ -237,6 +242,7 @@ class SettingsScreen extends StatelessWidget {
child: const Text('Yes'),
onPressed: () async {
await prefs.restoreDefaults();
if (!mounted) return;
Navigator.pop(context);
},
),
@@ -257,7 +263,7 @@ class SettingsScreen extends StatelessWidget {
final prefs = Provider.of<Preferences>(context);
return RestorationScope(
restorationId: restorationId,
restorationId: widget.restorationId,
child: CupertinoPageScaffold(
child: Container(
color:

View File

@@ -47,7 +47,8 @@ class ColorChangingIcon extends ImplicitlyAnimatedWidget {
final double? size;
@override
_ColorChangingIconState createState() => _ColorChangingIconState();
AnimatedWidgetBaseState<ColorChangingIcon> createState() =>
_ColorChangingIconState();
}
class _ColorChangingIconState
@@ -81,12 +82,10 @@ class CloseButton extends StatefulWidget {
final VoidCallback onPressed;
@override
CloseButtonState createState() {
return CloseButtonState();
}
State<CloseButton> createState() => _CloseButtonState();
}
class CloseButtonState extends State<CloseButton> {
class _CloseButtonState extends State<CloseButton> {
bool tapInProgress = false;
@override

View File

@@ -75,10 +75,10 @@ class SettingsItem extends StatefulWidget {
final SettingsItemCallback? onPress;
@override
State<StatefulWidget> createState() => SettingsItemState();
State<SettingsItem> createState() => _SettingsItemState();
}
class SettingsItemState extends State<SettingsItem> {
class _SettingsItemState extends State<SettingsItem> {
bool pressed = false;
@override

View File

@@ -13,7 +13,7 @@ class TriviaView extends StatefulWidget {
const TriviaView({this.id, this.restorationId, Key? key}) : super(key: key);
@override
_TriviaViewState createState() => _TriviaViewState();
State<TriviaView> createState() => _TriviaViewState();
}
/// Possible states of the game.

View File

@@ -66,7 +66,7 @@ class PressableCard extends StatefulWidget {
final Duration duration;
@override
_PressableCardState createState() => _PressableCardState();
State<PressableCard> createState() => _PressableCardState();
}
class _PressableCardState extends State<PressableCard> {