2023-07-29 18:10:10 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-07-30 15:31:36 +02:00
|
|
|
import 'package:fooder/client.dart';
|
2023-07-29 18:10:10 +02:00
|
|
|
|
2023-10-27 13:48:45 +02:00
|
|
|
TextStyle logoStyle(context) {
|
|
|
|
return Theme.of(context).textTheme.labelLarge!.copyWith(
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-29 18:10:10 +02:00
|
|
|
abstract class BasedScreen extends StatefulWidget {
|
|
|
|
final ApiClient apiClient;
|
|
|
|
|
|
|
|
const BasedScreen({super.key, required this.apiClient});
|
2024-03-28 16:25:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
abstract class BasedState<T extends BasedScreen> extends State<T> {
|
|
|
|
void showError(String message) {
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
SnackBar(
|
|
|
|
content: Text(
|
|
|
|
message,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.error,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-10-27 13:48:45 +02:00
|
|
|
|
2024-03-28 16:25:49 +01:00
|
|
|
void showText(String text) {
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
SnackBar(
|
|
|
|
content: Text(
|
|
|
|
text,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-07-29 18:10:10 +02:00
|
|
|
}
|