create project
This commit is contained in:
48
frontend/lib/widgets/number_pad.dart
Normal file
48
frontend/lib/widgets/number_pad.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/colors.dart';
|
||||
|
||||
class NumberPad extends StatelessWidget {
|
||||
final void Function(String key) onKeyTap;
|
||||
final String? Function()? onDelete;
|
||||
|
||||
const NumberPad({super.key, required this.onKeyTap, this.onDelete});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final keys = ['1','2','3','4','5','6','7','8','9','.', '0', 'delete'];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: GridView.count(
|
||||
crossAxisCount: 4,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
childAspectRatio: 1.5,
|
||||
children: keys.map((key) {
|
||||
final isDelete = key == 'delete';
|
||||
return GestureDetector(
|
||||
onTap: () => onKeyTap(key),
|
||||
child: Container(
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: isDelete ? AppColors.brand.withOpacity(0.08) : Colors.white.withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
isDelete ? '⌫' : key,
|
||||
style: TextStyle(
|
||||
fontSize: isDelete ? 20 : 22,
|
||||
fontWeight: isDelete ? FontWeight.w400 : FontWeight.w500,
|
||||
color: isDelete ? AppColors.brand : const Color(0xFF1C1C1E),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user