worldhopper/lib/screens/settings/dev_tests_screen.dart

71 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:worldhopper/helpers/snackbar_helper.dart';
import 'package:worldhopper/widgets/worldhopper_app_bar.dart';
/// Developer test screen for previewing UI components
class DevTestsScreen extends StatelessWidget {
const DevTestsScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const WorldhopperAppBar(
title: Text('Dev Tests'),
),
body: ListView(
children: [
_buildSectionHeader(context, 'Snack Bars'),
Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
children: [
ListTile(
leading: const Icon(Icons.check_circle, color: Colors.green),
title: const Text('Success'),
onTap: () =>
context.showSuccessSnackBar('This is a success message'),
),
const Divider(height: 1),
ListTile(
leading: Icon(Icons.error,
color: Theme.of(context).colorScheme.error),
title: const Text('Error'),
onTap: () =>
context.showErrorSnackBar('This is an error message'),
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.warning, color: Colors.orange),
title: const Text('Warning'),
onTap: () =>
context.showWarningSnackBar('This is a warning message'),
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.info_outline),
title: const Text('Info'),
onTap: () =>
context.showInfoSnackBar('This is an info message'),
),
],
),
),
const SizedBox(height: 16),
],
),
);
}
Widget _buildSectionHeader(BuildContext context, String title) {
return Padding(
padding: const EdgeInsets.fromLTRB(32, 24, 16, 8),
child: Text(
title,
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
);
}
}