2023-12-30 21:23:42 +00:00
|
|
|
import 'package:aurcache/components/builds_table.dart';
|
2024-01-01 16:11:05 +00:00
|
|
|
import 'package:aurcache/components/api/APIBuilder.dart';
|
2024-02-25 18:40:21 +00:00
|
|
|
import 'package:aurcache/components/table_info.dart';
|
2024-02-16 21:37:35 +00:00
|
|
|
import 'package:aurcache/providers/api/builds_provider.dart';
|
2023-12-30 21:23:42 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-19 19:00:10 +00:00
|
|
|
import 'package:provider/provider.dart';
|
2023-12-30 21:23:42 +00:00
|
|
|
import '../constants/color_constants.dart';
|
|
|
|
import '../models/build.dart';
|
|
|
|
|
|
|
|
class BuildsScreen extends StatelessWidget {
|
|
|
|
const BuildsScreen({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2024-02-24 22:48:16 +00:00
|
|
|
appBar: AppBar(
|
|
|
|
title: const Text("All Builds"),
|
|
|
|
),
|
2024-01-19 19:00:10 +00:00
|
|
|
body: MultiProvider(
|
|
|
|
providers: [
|
|
|
|
ChangeNotifierProvider<BuildsProvider>(
|
|
|
|
create: (_) => BuildsProvider()),
|
|
|
|
],
|
|
|
|
child: Padding(
|
2023-12-30 21:23:42 +00:00
|
|
|
padding: const EdgeInsets.all(defaultPadding),
|
2024-01-19 19:00:10 +00:00
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.all(defaultPadding),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
color: secondaryColor,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
|
|
),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"All Builds",
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
child: APIBuilder<BuildsProvider, List<Build>, Object>(
|
|
|
|
key: const Key("Builds on seperate screen"),
|
|
|
|
interval: const Duration(seconds: 10),
|
|
|
|
onLoad: () => const Text("no data"),
|
|
|
|
onData: (data) {
|
2024-02-25 18:40:21 +00:00
|
|
|
if (data.isEmpty) {
|
|
|
|
return const TableInfo(
|
|
|
|
title: "You have no builds yet");
|
|
|
|
} else {
|
|
|
|
return BuildsTable(data: data);
|
|
|
|
}
|
2024-01-19 19:00:10 +00:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2023-12-30 21:23:42 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|