srs/lib/features/orders/order_card.dart
Aswin Biju 45fcdcebfb Initial commit
Add SRS app: results, shops, orders and users, wired to srs-api
Flutter web/PWA for the lottery agency, built on Riverpod and go_router,
talking to srs-api over HTTP (HttpApi, token kept in SharedPreferences).

- Results, Shops, Orders and Users tabs (Users for admins only), with
  phone, tablet and desktop layouts and shared widgets and theme tokens
- Users: list with search and Active/Inactive filters; user detail with
  shops, sign-in details, and an Access card
- WhatsApp results switch on each user (sendResults on
  PATCH /api/users/:id). Shows the WhatsApp logo (Simple Icons, CC0,
  drawn with flutter_svg), green only when results will really go out.
  Can't be turned on without a phone number ("Add a phone number first"
  opens the phone sheet), and is paused while the user is inactive. The
  users list marks people who get results with the logo.
- Each Access switch has a one-line description; the explanation
  paragraphs are gone
- Remove demo mode: the app always uses the real AP
  test/support and is used only by tests.
2026-11-04 23:21:50 +05:30

82 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/format.dart';
import '../../core/models.dart';
import '../../core/theme.dart';
import '../../widgets/ui.dart';
class OrderCard extends StatelessWidget {
const OrderCard({super.key, required this.order, required this.onTap});
final Order order;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final o = order;
return SrsCard(
onTap: onTap,
padding: const EdgeInsets.all(S.s14),
child: Row(
children: [
CodeTile(o.shop.code),
const SizedBox(width: S.s14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Flexible(
child: Text(
o.shop.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: ts(15, w: w6),
),
),
if (o.edited) ...[
const SizedBox(width: S.s8),
const Pill('Edited', bg: C.goldTint, fg: C.goldText),
],
],
),
const SizedBox(height: S.s4),
Row(
children: [
Icon(
o.isPhoto
? Icons.photo_camera_outlined
: Icons.chat_bubble_outline_rounded,
size: 13,
color: C.muted,
),
const SizedBox(width: S.s6),
Flexible(
child: Text(
'${o.shop.code} · ${time12(o.time)} · ${o.isPhoto ? 'Photo' : 'Text'}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: ts(12, c: C.muted),
),
),
],
),
],
),
),
const SizedBox(width: S.s8),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(inr(o.tickets), style: ts(18, w: w7)),
Text('tickets', style: ts(11, c: C.muted)),
],
),
const SizedBox(width: S.s4),
const Icon(Icons.chevron_right_rounded, color: C.placeholder),
],
),
);
}
}