blob: 48dadeb9df65a0dcc39fc72649bc1da9ee720c18 [file] [log] [blame]
// Copyright 2019 The Flutter team. 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 'package:gallery/layout/adaptive.dart';
import 'package:gallery/studies/rally/colors.dart';
import 'package:gallery/studies/rally/data.dart';
import 'package:gallery/studies/rally/routes.dart' as rally_route;
class SettingsView extends StatefulWidget {
const SettingsView({super.key});
@override
State<SettingsView> createState() => _SettingsViewState();
}
class _SettingsViewState extends State<SettingsView> {
@override
Widget build(BuildContext context) {
return FocusTraversalGroup(
child: Container(
padding: EdgeInsets.only(top: isDisplayDesktop(context) ? 24 : 0),
child: ListView(
restorationId: 'settings_list_view',
shrinkWrap: true,
children: [
for (String title
in DummyDataService.getSettingsTitles(context)) ...[
_SettingsItem(title),
const Divider(
color: RallyColors.dividerColor,
height: 1,
)
]
],
),
),
);
}
}
class _SettingsItem extends StatelessWidget {
const _SettingsItem(this.title);
final String title;
@override
Widget build(BuildContext context) {
return TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white,
padding: EdgeInsets.zero,
),
onPressed: () {
Navigator.of(context).restorablePushNamed(rally_route.loginRoute);
},
child: Container(
alignment: AlignmentDirectional.centerStart,
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 28),
child: Text(title),
),
);
}
}