mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Beta (#1234)
This commit is contained in:
@@ -255,7 +255,7 @@ class DetailsScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
_DetailsScreenState createState() => _DetailsScreenState();
|
||||
State<DetailsScreen> createState() => _DetailsScreenState();
|
||||
}
|
||||
|
||||
class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user