2023-11-14 15:28:14 -04:00
|
|
|
import 'package:flutter/material.dart';
|
2023-10-03 13:00:59 -04:00
|
|
|
import 'package:recon/auxiliary.dart';
|
|
|
|
import 'package:recon/models/session.dart';
|
|
|
|
import 'package:recon/widgets/formatted_text.dart';
|
|
|
|
import 'package:recon/widgets/generic_avatar.dart';
|
|
|
|
import 'package:recon/widgets/sessions/session_view.dart';
|
2023-05-06 13:24:28 -04:00
|
|
|
|
|
|
|
class SessionTile extends StatelessWidget {
|
|
|
|
const SessionTile({required this.session, super.key});
|
2023-06-24 07:34:25 -04:00
|
|
|
|
2023-05-06 13:24:28 -04:00
|
|
|
final Session session;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextButton(
|
2023-06-24 07:34:25 -04:00
|
|
|
style: TextButton.styleFrom(
|
|
|
|
foregroundColor: Theme.of(context).colorScheme.onSurface,
|
|
|
|
),
|
2023-05-06 13:24:28 -04:00
|
|
|
onPressed: () {
|
2023-05-29 14:16:23 -04:00
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SessionView(session: session)));
|
2023-05-06 13:24:28 -04:00
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
2023-09-30 06:22:32 -04:00
|
|
|
GenericAvatar(imageUri: Aux.resdbToHttp(session.thumbnailUrl), placeholderIcon: Icons.no_photography),
|
2023-05-06 13:24:28 -04:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2023-05-15 05:46:31 -04:00
|
|
|
FormattedText(session.formattedName),
|
2023-06-24 07:34:25 -04:00
|
|
|
Text(
|
|
|
|
"${session.sessionUsers.length.toString().padLeft(2, "0")}/${session.maxUsers.toString().padLeft(2, "0")} active users",
|
2023-11-14 15:28:14 -04:00
|
|
|
style: Theme.of(context)
|
|
|
|
.textTheme
|
|
|
|
.labelMedium
|
|
|
|
?.copyWith(color: Theme.of(context).colorScheme.onSurface.withOpacity(.6)),
|
2023-06-24 07:34:25 -04:00
|
|
|
)
|
2023-05-06 13:24:28 -04:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2023-06-24 07:34:25 -04:00
|
|
|
}
|