大幅変更&環境バージョンアップ
This commit is contained in:
57
lib/pages/team/team_list_page.dart
Normal file
57
lib/pages/team/team_list_page.dart
Normal file
@ -0,0 +1,57 @@
|
||||
// lib/pages/team/team_list_page.dart
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gifunavi/pages/team/team_controller.dart';
|
||||
import 'package:gifunavi/routes/app_pages.dart';
|
||||
|
||||
class TeamListPage extends GetWidget<TeamController> {
|
||||
const TeamListPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('チーム管理'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () => Get.toNamed(AppPages.TEAM_DETAIL, arguments: {'mode': 'new'}),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Obx(() {
|
||||
if (controller.isLoading.value) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (controller.error.value.isNotEmpty) {
|
||||
return Center(child: Text(controller.error.value));
|
||||
} else if (controller.teams.isEmpty) {
|
||||
return const Center(child: Text('チームがありません'));
|
||||
} else {
|
||||
return RefreshIndicator(
|
||||
onRefresh: controller.fetchTeams,
|
||||
child: ListView.builder(
|
||||
itemCount: controller.teams.length,
|
||||
itemBuilder: (context, index) {
|
||||
final team = controller.teams[index];
|
||||
return ListTile(
|
||||
title: Text(team.teamName),
|
||||
subtitle: Text('${team.category.categoryName} '),
|
||||
onTap: () async {
|
||||
await Get.toNamed(
|
||||
AppPages.TEAM_DETAIL,
|
||||
arguments: {'mode': 'edit', 'team': team},
|
||||
);
|
||||
controller.fetchTeams();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user