This commit is contained in:
2026-08-07 15:31:20 +05:30
parent 09e5e29df2
commit ad44402232
17 changed files with 598 additions and 1187 deletions

View File

@@ -1,10 +1,6 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../app/providers.dart';
import '../../../core/config/api_config.dart';
import '../../../data/local/app_database.dart';
import '../../../data/local/staff_dao.dart';
import '../../../data/remote/auth_api.dart';
import '../../../domain/entities/store_account.dart';
/// Sign-in state for the terminal.
@@ -27,7 +23,6 @@ class Authenticated extends AuthState {
required this.store,
required this.user,
required this.login,
this.session,
});
final StoreAccount store;
@@ -37,25 +32,10 @@ class Authenticated extends AuthState {
/// is allowed to show — not [user], which can be swapped at the till.
final TerminalLogin login;
/// What the back office answered with. Null only on the offline demo path,
/// where there was no back office to answer.
///
/// Everything downstream reads from here rather than from a constant: the
/// bearer token for the catalogue pull and the order push, the location id
/// they are scoped to, and the tenant name shown beside the logo.
final LoginSession? session;
StaffRole get role => login.role;
bool get isAdmin => login == TerminalLogin.admin;
bool get isCashier => login == TerminalLogin.cashier;
/// The name beside the logo: the tenant, then the outlet, then whatever the
/// store record on this terminal says.
String get storeName {
final fromApi = session?.displayStoreName ?? '';
return fromApi.isNotEmpty ? fromApi : store.name;
}
}
class AuthFailure extends AuthState {
@@ -64,19 +44,19 @@ class AuthFailure extends AuthState {
final String message;
}
/// What this terminal is allowed to open.
/// The two ways into this terminal.
///
/// No longer a credential — the back office decides the role now, and
/// [AuthController.signIn] maps its answer onto one of these. The two values
/// remain because the whole shell keys off them:
/// Store-level credentials, not a person's: they are replaced wholesale when
/// the terminal is registered against a real back office. Staff PINs — the
/// credential that actually opens a till drawer — are not here. They live
/// hashed in the database.
///
/// * [admin] runs the full shell and is the only login that can pull the
/// The split is what the two roles are *for*, not decoration:
///
/// * [admin] runs the whole shell and is the only login that can pull the
/// catalogue. Signing out leaves the products on the terminal.
/// * [cashier] gets the billing screen and nothing else, and every way out of
/// the session takes the catalogue with it.
///
/// The email and password fields are the built-in demo accounts, used only by
/// the offline path — see [ApiConfig.allowOfflineDemoLogin].
/// * [cashier] gets the billing screen and nothing else, and signing out
/// takes the catalogue with it.
enum TerminalLogin {
admin(
label: 'Admin',
@@ -121,7 +101,7 @@ enum TerminalLogin {
}
}
/// The built-in accounts, used only by the offline path.
/// Kept for the store record, which is keyed on the outlet's own address.
class DemoCredentials {
const DemoCredentials._();
@@ -132,7 +112,7 @@ class DemoCredentials {
static const String cashierPassword = 'cashier123';
}
/// Signs the terminal in against the back office and holds the session.
/// Validates store credentials and holds the signed-in session.
class AuthController extends StateNotifier<AuthState> {
AuthController(this._ref) : super(const Unauthenticated());
@@ -147,152 +127,44 @@ class AuthController extends StateNotifier<AuthState> {
return current is Authenticated && current.login.clearsCatalogueOnSignOut;
}
/// Signs in against `POST /login`.
///
/// The back office decides everything the terminal then does: the role that
/// picks admin shell or billing screen, the location the catalogue is pulled
/// for, and the token every later call carries. Nothing here is chosen at
/// the login screen any more.
Future<bool> signIn({
required String email,
required String password,
}) async {
state = const Authenticating();
final store = _ref.read(localStoreProvider);
// This till's own minted identity, not a fresh uuid — the back office can
// recognise a terminal across restarts and refuse one it has not
// registered.
final deviceId = store.isReady ? store.terminal.deviceId : 'unopened';
// Stand-in for the network round trip.
await Future<void>.delayed(const Duration(milliseconds: 600));
LoginSession session;
try {
session = await _ref.read(authApiProvider).login(
authname: email,
password: password,
deviceId: deviceId,
);
} on ApiException catch (e) {
// A refusal is final. Only a shop with no line at all may fall through,
// and only onto the built-in accounts — a wrong password must never
// quietly become a local sign-in.
if (ApiConfig.allowOfflineDemoLogin && e.isNetworkFault) {
final offline = await _signInOffline(email, password);
if (offline) return true;
}
state = AuthFailure(e.message);
return false;
}
try {
await _applySession(session);
} on Object catch (e) {
state = AuthFailure(
'Signed in, but this terminal could not store the store details: $e',
);
return false;
}
return true;
}
/// Writes everything the session decided into the terminal, then opens it.
///
/// Order matters. The store id and terminal identity are written first,
/// because `syncConfigProvider` is derived from them and from the session —
/// setting the session last means the catalogue and order transports are
/// rebuilt once, already pointing at the right location with the right
/// token.
Future<void> _applySession(LoginSession session) async {
final store = _ref.read(localStoreProvider);
final catalogue = store.catalogue;
// 1. The outlet, as the back office describes it. These are printed on
// every GST invoice, so they come from the server rather than from the
// build's constants.
await catalogue.setMeta(MetaKeys.storeId, session.storeId);
if (session.displayStoreName.isNotEmpty) {
await catalogue.setMeta(MetaKeys.storeName, session.displayStoreName);
}
if (session.address.isNotEmpty) {
await catalogue.setMeta(MetaKeys.storeAddress, session.address);
}
if (session.phone.isNotEmpty) {
await catalogue.setMeta(MetaKeys.storePhone, session.phone);
}
// 2. This till now belongs to that outlet. Reloaded rather than left to a
// restart: the cached identity is what every bill and topic reads.
await store.identityStore.rename(storeId: session.storeId);
await store.reloadTerminal();
_ref.invalidate(terminalIdentityProvider);
// 3. The staff list, so PIN switching at the counter works against the
// people head office actually employs.
final me = await _syncStaff(session);
// 4. Open the session. syncConfigProvider watches this, so the catalogue
// pull and the order push pick up the token and location id from here.
final account = await _ref.read(storeRepositoryProvider).load(
email: session.email.isEmpty ? DemoCredentials.email : session.email,
);
state = Authenticated(
store: account,
user: me,
login: session.isAdmin ? TerminalLogin.admin : TerminalLogin.cashier,
session: session,
);
_ref.invalidate(storeAccountProvider);
}
/// Mirrors the back office's staff list onto this terminal, and returns the
/// row for whoever just signed in.
///
/// Additive on purpose. Deactivating everyone the server did not mention
/// would lock a shop out of its own till the first time the endpoint answers
/// with an empty array — which is exactly what the sample response does.
Future<StaffUser> _syncStaff(LoginSession session) async {
final dao = _ref.read(localStoreProvider).staff;
for (final member in session.staff) {
if (member.userId == 0) continue;
await dao.upsertFromServer(
id: StaffDao.serverId(member.userId),
name: member.fullName,
role: member.staffRole,
pin: member.pin,
isActive: member.isActive,
);
}
// The person who signed in may not appear in that list — `staff` comes
// back empty for a single-operator shop. They still need a row, because
// every bill is stamped with a staff id.
return dao.upsertFromServer(
id: StaffDao.serverId(session.userId),
name: session.displayUserName,
role: session.staffRole,
pin: session.whoAmI?.pin,
);
}
/// The built-in accounts, for a terminal with no line to the back office.
///
/// Development only — see [ApiConfig.allowOfflineDemoLogin]. It reaches no
/// server, so it sets no token: the catalogue cannot be pulled and bills
/// cannot be pushed until a real sign-in happens.
Future<bool> _signInOffline(String email, String password) async {
final login = TerminalLogin.byEmail(email);
if (login == null || password != login.password) return false;
final store = await _ref.read(storeRepositoryProvider).load(email: email);
if (store.staff.isEmpty) return false;
if (login == null) {
state = const AuthFailure('No account is registered against that email.');
return false;
}
final opener = store.staff.firstWhere(
if (password != login.password) {
state = const AuthFailure('Incorrect password. Please try again.');
return false;
}
final store = await _ref.read(storeAccountProvider.future);
final staff = store.staff;
if (staff.isEmpty) {
state = const AuthFailure(
'This terminal has no staff accounts. Reinstall to seed them.',
);
return false;
}
// Whoever on this terminal matches the role that just signed in. Falls
// back rather than failing: the session's permissions come from [login],
// so a shop with no cashier row still gets a usable till — the bills are
// just stamped with the account that is there.
final opener = staff.firstWhere(
(s) => s.role == login.role,
orElse: () => store.staff.first,
orElse: () => staff.first,
);
state = Authenticated(store: store, user: opener, login: login);
@@ -318,7 +190,6 @@ class AuthController extends StateNotifier<AuthState> {
store: current.store,
user: user,
login: current.login,
session: current.session,
);
return true;
}
@@ -338,24 +209,19 @@ class AuthController extends StateNotifier<AuthState> {
// would keep stamping bills with an account the shop has revoked.
user: me.isEmpty ? store.staff.first : me.first,
login: current.login,
session: current.session,
);
}
/// Ends the session, and — for a cashier only — the catalogue with it.
///
/// Every way out of a cashier session clears the products: ending a shift,
/// and a temporary logout alike. There is no exception for stepping away for
/// ten minutes, because the terminal is left unattended either way and the
/// next session should bill against what the back office answers with rather
/// than a catalogue carried over.
/// Every cashier sign-out drops the products, whatever the reason for it.
/// The next shift should bill against what the back office answers with,
/// never a catalogue carried over, and a terminal left at a login screen
/// must not be sitting on a shop's prices and stock.
///
/// An admin signing out is the opposite case. They have just pulled the
/// products *so that* a cashier can pick the terminal up, so dropping the
/// table here would make the import pointless.
///
/// The bearer token needs no clearing: it lives on the session, so it goes
/// when the state does, and `syncConfigProvider` is derived from it.
Future<void> signOut() async {
if (clearsCatalogueOnSignOut) {
await _ref.read(localStoreProvider).clearCatalogue();
@@ -384,31 +250,6 @@ final currentUserProvider = Provider<StaffUser?>((ref) {
return s is Authenticated ? s.user : null;
});
/// What the back office answered with, or null before sign-in.
///
/// `select` rather than a plain watch: the whole sync configuration is derived
/// from this, and rebuilding the transports on every intermediate auth state
/// would tear down a connection mid-request.
final apiSessionProvider = Provider<LoginSession?>((ref) {
return ref.watch(
authControllerProvider.select(
(s) => s is Authenticated ? s.session : null,
),
);
});
/// The name shown beside the logo — tenant first, then the outlet, then the
/// store record on this terminal.
final storeDisplayNameProvider = Provider<String>((ref) {
final s = ref.watch(authControllerProvider);
return s is Authenticated ? s.storeName : '';
});
/// The outlet, for the line under the store name.
final locationDisplayNameProvider = Provider<String>((ref) {
return ref.watch(apiSessionProvider)?.locationName.trim() ?? '';
});
/// Which credential is holding this session open, or null before sign-in.
final terminalLoginProvider = Provider<TerminalLogin?>((ref) {
final s = ref.watch(authControllerProvider);

View File

@@ -1,4 +1,4 @@
import 'dart:ui';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
@@ -6,9 +6,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../app/providers.dart';
import '../../../core/constants/asset_paths.dart';
import '../../../core/router/app_router.dart';
import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart';
import '../../../core/utils/validators.dart';
import '../../../core/widgets/brand_mark.dart';
import '../../../core/widgets/primary_button.dart';
import '../providers/auth_controller.dart';
@@ -31,17 +33,27 @@ class LoginScreen extends ConsumerStatefulWidget {
class _LoginScreenState extends ConsumerState<LoginScreen> {
final _formKey = GlobalKey<FormState>();
// Blank on purpose. The role tabs that used to sit above these fields chose
// between two built-in accounts and decided, locally, whether the terminal
// opened the admin shell or the billing screen. The back office decides that
// now — `POST /login` answers with the role — so offering the choice here
// would only let someone pick a screen the server is about to override.
final _email = TextEditingController();
final _password = TextEditingController();
/// Which of the two default accounts the tabs are pointing at. Only a
/// convenience for filling the fields — [AuthController.signIn] decides the
/// role from the email that is actually submitted, so typing a different
/// address over the top still signs in as that account.
TerminalLogin _login = TerminalLogin.admin;
late final _email = TextEditingController(text: _login.email);
late final _password = TextEditingController(text: _login.password);
bool _obscure = true;
bool _rememberTerminal = true;
void _selectLogin(TerminalLogin login) {
setState(() {
_login = login;
_email.text = login.email;
_password.text = login.password;
});
ref.read(authControllerProvider.notifier).clearError();
}
@override
void dispose() {
_email.dispose();
@@ -54,9 +66,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
if (!(_formKey.currentState?.validate() ?? false)) return;
final ok = await ref.read(authControllerProvider.notifier).signIn(
email: _email.text,
password: _password.text,
);
email: _email.text,
password: _password.text,
);
if (ok && mounted) context.go(AppRoutes.pos);
}
@@ -68,18 +80,11 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
final busy = auth is Authenticating;
return Scaffold(
backgroundColor: AppColors.background,
body: Stack(
fit: StackFit.expand,
children: [
// Background image
Image.asset(
'assets/images/bg.webp',
fit: BoxFit.cover,
),
// Light blur over the image
const _Backdrop(),
SafeArea(
child: LayoutBuilder(
builder: (context, box) {
@@ -91,8 +96,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
vertical: tight ? AppSpacing.xl : AppSpacing.xxxl,
),
child: ConstrainedBox(
// Fills the viewport so the card is centred vertically, and
// scrolls the moment it cannot be.
// Fills the viewport so the card is centred vertically,
// and scrolls the moment it cannot be.
constraints: BoxConstraints(
minHeight: (box.maxHeight - (tight ? 40 : 64))
.clamp(0.0, double.infinity),
@@ -104,17 +109,21 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_Masthead(tight: tight),
// _Masthead(tight: tight),
SizedBox(
height: tight ? AppSpacing.lg : AppSpacing.xl,),
height: tight ? AppSpacing.lg : AppSpacing.xl,
),
_Card(
formKey: _formKey,
email: _email,
password: _password,
obscure: _obscure,
rememberTerminal: _rememberTerminal,
login: _login,
busy: busy,
failure: auth is AuthFailure ? auth.message : null,
failure:
auth is AuthFailure ? auth.message : null,
onSelectLogin: _selectLogin,
onToggleObscure: () =>
setState(() => _obscure = !_obscure),
onToggleRemember: (v) =>
@@ -125,9 +134,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
Center(
child: Text(
'Terminal ${session.terminalId}',
style: const TextStyle(
style: TextStyle(
fontSize: 11.5,
color: AppColors.textTertiary,
color: Colors.white.withValues(alpha: 0.72),
),
),
),
@@ -146,6 +155,58 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
}
}
/// The shopfront behind the form.
///
/// Blurred hard and darkened, because it is atmosphere rather than something
/// to read: a sharp photograph under a sign-in card competes with the two
/// fields the person came here to fill in. Scaled up slightly before the blur
/// so the softened edges are pushed off-screen instead of showing as a pale
/// border.
///
/// Falls back to the plain background colour if the asset is missing, so an
/// undeclared file costs the login screen its atmosphere and not its function.
class _Backdrop extends StatelessWidget {
const _Backdrop();
@override
Widget build(BuildContext context) {
return Stack(
fit: StackFit.expand,
children: [
ClipRect(
child: ImageFiltered(
imageFilter: ui.ImageFilter.blur(sigmaX: 0, sigmaY: 0),
child: Transform.scale(
scale: 1.12,
child: Image.asset(
AssetPaths.loginBackground,
fit: BoxFit.cover,
filterQuality: FilterQuality.medium,
errorBuilder: (context, _, __) =>
const ColoredBox(color: AppColors.background),
),
),
),
),
// Two layers, not one: the flat wash guarantees contrast for the white
// masthead wherever the photograph happens to be pale, and the gradient
// puts the darkest part behind the text rather than spreading it evenly
// and flattening the image out.
const ColoredBox(color: Color(0x8A1A0B22)),
const DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0x66000000), Color(0x22000000), Color(0x77000000)],
),
),
),
],
);
}
}
/// Mark and product name, directly above the card.
class _Masthead extends StatelessWidget {
const _Masthead({required this.tight});
@@ -156,25 +217,31 @@ class _Masthead extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
// BrandMark(size: tight ? 48 : 60),
BrandMark(size: tight ? 48 : 60),
const SizedBox(height: AppSpacing.md),
const Text(
'Nearle POS',
style: TextStyle(
fontSize: 20,
fontSize: 22,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
color: Colors.white,
height: 1.2,
shadows: [
Shadow(color: Color(0x66000000), blurRadius: 12),
],
),
),
if (!tight) ...[
const SizedBox(height: 2),
const Text(
Text(
'Scanner-first billing for Indian retail',
style: TextStyle(
fontSize: 13,
color: AppColors.textSecondary,
color: Colors.white.withValues(alpha: 0.82),
shadows: const [
Shadow(color: Color(0x55000000), blurRadius: 10),
],
),
),
],
@@ -190,8 +257,10 @@ class _Card extends StatelessWidget {
required this.password,
required this.obscure,
required this.rememberTerminal,
required this.login,
required this.busy,
required this.failure,
required this.onSelectLogin,
required this.onToggleObscure,
required this.onToggleRemember,
required this.onSubmit,
@@ -202,8 +271,10 @@ class _Card extends StatelessWidget {
final TextEditingController password;
final bool obscure;
final bool rememberTerminal;
final TerminalLogin login;
final bool busy;
final String? failure;
final ValueChanged<TerminalLogin> onSelectLogin;
final VoidCallback onToggleObscure;
final ValueChanged<bool?> onToggleRemember;
final VoidCallback onSubmit;
@@ -218,9 +289,9 @@ class _Card extends StatelessWidget {
border: Border.all(color: AppColors.border),
boxShadow: const [
BoxShadow(
color: Color(0x0F101828),
blurRadius: 24,
offset: Offset(0, 8),
color: Color(0x33101828),
blurRadius: 40,
offset: Offset(0, 16),
),
],
),
@@ -251,17 +322,31 @@ class _Card extends StatelessWidget {
),
const SizedBox(height: AppSpacing.xl),
const _Label('Email or username'),
_RoleSwitch(
selected: login,
enabled: !busy,
onSelect: onSelectLogin,
),
const SizedBox(height: AppSpacing.sm),
Text(
login.blurb,
style: const TextStyle(
fontSize: 12.5,
color: AppColors.textTertiary,
height: 1.45,
),
),
const SizedBox(height: AppSpacing.xl),
const _Label('Store email'),
TextFormField(
controller: email,
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next,
enabled: !busy,
// Not validated as an email. The back office takes this as
// `authname` and accepts either form; rejecting a username here
// would block an account the server would have let in.
validator: (v) =>
(v ?? '').trim().isEmpty ? 'This is required' : null,
validator: (v) => (v ?? '').trim().isEmpty
? 'Store email is required'
: Validators.emailOptional(v),
decoration: const InputDecoration(
hintText: 'store@example.in',
prefixIcon: Icon(Icons.storefront_outlined),
@@ -276,8 +361,9 @@ class _Card extends StatelessWidget {
enabled: !busy,
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) => onSubmit(),
validator: (v) =>
(v ?? '').isEmpty ? 'Password is required' : null,
validator: (v) => (v ?? '').isEmpty
? 'Password is required'
: ((v ?? '').length < 6 ? 'Password looks too short' : null),
decoration: InputDecoration(
hintText: 'Enter your password',
prefixIcon: const Icon(Icons.lock_outline_rounded),
@@ -347,7 +433,7 @@ class _Card extends StatelessWidget {
child: Row(
children: [
const Icon(Icons.error_outline_rounded,
color: AppColors.danger, size: 18,),
color: AppColors.danger, size: 18,),
const SizedBox(width: AppSpacing.sm),
Expanded(
child: Text(
@@ -371,6 +457,12 @@ class _Card extends StatelessWidget {
busy: busy,
onPressed: onSubmit,
),
const SizedBox(height: AppSpacing.lg),
_DemoHint(
login: login,
onFill: busy ? null : () => onSelectLogin(login),
),
],
),
),
@@ -399,3 +491,167 @@ class _Label extends StatelessWidget {
}
}
/// Which of the two default accounts is being signed into.
///
/// The roles are not cosmetic — they decide whether the terminal opens the
/// full shell or the billing screen alone, and whether signing out leaves the
/// products behind — so the choice is made before the credentials rather than
/// inferred from them afterwards.
class _RoleSwitch extends StatelessWidget {
const _RoleSwitch({
required this.selected,
required this.enabled,
required this.onSelect,
});
final TerminalLogin selected;
final bool enabled;
final ValueChanged<TerminalLogin> onSelect;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: AppColors.surfaceAlt,
borderRadius: AppRadius.brSm,
border: Border.all(color: AppColors.border),
),
child: Row(
children: [
for (final login in TerminalLogin.values)
Expanded(
child: _RoleTab(
login: login,
selected: login == selected,
enabled: enabled,
onTap: () => onSelect(login),
),
),
],
),
);
}
}
class _RoleTab extends StatelessWidget {
const _RoleTab({
required this.login,
required this.selected,
required this.enabled,
required this.onTap,
});
final TerminalLogin login;
final bool selected;
final bool enabled;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final icon = login == TerminalLogin.admin
? Icons.admin_panel_settings_outlined
: Icons.point_of_sale_rounded;
return Material(
color: Colors.transparent,
child: InkWell(
onTap: enabled ? onTap : null,
borderRadius: AppRadius.brXs,
child: AnimatedContainer(
duration: const Duration(milliseconds: 160),
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
color: selected ? AppColors.surface : Colors.transparent,
borderRadius: AppRadius.brXs,
border: Border.all(
color: selected ? AppColors.primaryBorder : Colors.transparent,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: 17,
color: selected ? AppColors.primary : AppColors.textSecondary,
),
const SizedBox(width: AppSpacing.sm),
Flexible(
child: Text(
login.label,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.5,
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
color:
selected ? AppColors.primary : AppColors.textSecondary,
),
),
),
],
),
),
),
);
}
}
class _DemoHint extends StatelessWidget {
const _DemoHint({required this.login, this.onFill});
final TerminalLogin login;
final VoidCallback? onFill;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(AppSpacing.md),
decoration: BoxDecoration(
color: AppColors.primarySurface,
borderRadius: AppRadius.brSm,
border: Border.all(color: AppColors.primaryBorder),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(Icons.info_outline_rounded,
size: 17, color: AppColors.primary,),
const SizedBox(width: AppSpacing.sm),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Default ${login.label.toLowerCase()} account',
style: const TextStyle(
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: AppColors.primary,
),
),
const SizedBox(height: 2),
SelectableText(
'${login.email} \u00b7 ${login.password}',
style: const TextStyle(
fontSize: 12,
color: AppColors.textSecondary,
),
),
],
),
),
TextButton(
onPressed: onFill,
style: TextButton.styleFrom(
minimumSize: const Size(0, 32),
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.sm),
),
child: const Text('Fill', style: TextStyle(fontSize: 12.5)),
),
],
),
);
}
}