Files
kmobile/lib/features/yojna/screens/gov_scheme_screen.dart

166 lines
5.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:kmobile/data/models/user.dart';
import 'package:kmobile/features/yojna/screens/apy_screen.dart';
import 'package:kmobile/features/yojna/screens/pm_main_screen.dart';
import '../../../l10n/app_localizations.dart';
class GovSchemeScreen extends StatefulWidget {
final List<User> users;
final int selectedIndex;
const GovSchemeScreen({
super.key,
required this.users,
required this.selectedIndex,
});
@override
State<GovSchemeScreen> createState() => _GovSchemeScreenState();
}
class _GovSchemeScreenState extends State<GovSchemeScreen> {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: Text(l10n.governmentSchemes),
),
body: Stack(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: GovSchemeTile(
logoText: "PMJJBY/PMSBY",
label: l10n.pradhanMantriYojana,
subtitle: l10n.enrollPMJJBYPMSBY,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PMMainScreen(
users: widget.users,
selectedIndex: widget.selectedIndex,
),
),
);
},
),
),
Expanded(
child: GovSchemeTile(
logoText: "APY",
label: l10n.registerForAtalPensionYojana,
subtitle: l10n.secureYourFutureAPY,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => APYScreen(
users: widget.users,
selectedIndex: widget.selectedIndex,
),
),
); // Action for APY will be added later
},
),
),
],
),
),
IgnorePointer(
child: Center(
child: Opacity(
opacity: 0.07,
child: ClipOval(
child: Image.asset(
'assets/images/logo.png',
width: 200,
height: 200,
),
),
),
),
),
],
),
);
}
}
class GovSchemeTile extends StatelessWidget {
final String logoText;
final String label;
final String? subtitle;
final VoidCallback onTap;
final bool disable;
const GovSchemeTile({
super.key,
required this.logoText,
required this.label,
this.subtitle,
required this.onTap,
this.disable = false,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Card(
margin: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
elevation: 4,
child: InkWell(
onTap: disable ? null : onTap,
borderRadius: BorderRadius.circular(12.0),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 36.0, horizontal: 16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
logoText,
style: TextStyle(
fontSize: logoText.length > 5 ? 28 : 40,
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
),
),
const SizedBox(height: 16),
Text(
label,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
color: disable
? theme.disabledColor
: theme.colorScheme.onSurface,
),
),
if (subtitle != null)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
subtitle!,
textAlign: TextAlign.center,
style: theme.textTheme.bodyMedium?.copyWith(
color: disable
? theme.disabledColor
: theme.colorScheme.onSurfaceVariant,
),
),
),
],
),
),
),
);
}
}