feat: add custom widget
This commit is contained in:
parent
f383766812
commit
e9911c4309
|
|
@ -1,11 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColor {
|
||||
static const Color green = Color(0xFF00B14F);
|
||||
static const Color primary = Color(0xFF00B14F);
|
||||
static const Color greenLight = Color(0xFFE6F4F1);
|
||||
static const Color greenDark = Color(0xFF00913A);
|
||||
|
||||
static const Color greenText = Color(0xFF00B14F);
|
||||
static const Color greenTextLight = Color(0xFFE6F4F1);
|
||||
static const Color greenTextDark = Color(0xFF00913A);
|
||||
|
||||
static const Color textDisable = Color(0xFFBDBDBD);
|
||||
}
|
||||
|
|
|
|||
5
kebun_pintar/lib/core/extension/extention.dart
Normal file
5
kebun_pintar/lib/core/extension/extention.dart
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Extenstion {
|
||||
static String capitalize(String s) {
|
||||
return s[0].toUpperCase() + s.substring(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:kebun_pintar/core/constant/app_color.dart';
|
||||
|
||||
class AppButton extends StatelessWidget {
|
||||
const AppButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.text,
|
||||
this.backgroundColor = AppColor.primary,
|
||||
this.foregroundColor = Colors.white,
|
||||
this.borderSide,
|
||||
});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final String text;
|
||||
final Color backgroundColor;
|
||||
final Color foregroundColor;
|
||||
final BorderSide? borderSide;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
shadowColor: Colors.transparent,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14.sp, fontWeight: FontWeight.w500, fontFamily: 'Onest'),
|
||||
backgroundColor: backgroundColor,
|
||||
foregroundColor: foregroundColor,
|
||||
minimumSize: Size(double.infinity, 48.h),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: borderSide ?? BorderSide.none,
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
),
|
||||
),
|
||||
child: Text(text),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:kebun_pintar/core/constant/app_color.dart';
|
||||
|
||||
class CustomTextField extends StatelessWidget {
|
||||
const CustomTextField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.hintText = 'Enter Here',
|
||||
this.suffixIcon,
|
||||
});
|
||||
|
||||
final TextEditingController controller;
|
||||
final String hintText;
|
||||
final Widget? suffixIcon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColor.textDisable, width: 1.r),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
gapPadding: 10.r),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColor.primary, width: 1.r),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
gapPadding: 10.r),
|
||||
hintText: hintText,
|
||||
// hintStyle: AppTheme.hintStyle,
|
||||
suffixIcon: suffixIcon),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -102,6 +102,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
flutter_screenutil:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_screenutil
|
||||
sha256: "8239210dd68bee6b0577aa4a090890342d04a136ce1c81f98ee513fc0ce891de"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.9.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+>1
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.1
|
||||
|
|
@ -40,6 +40,7 @@ dependencies:
|
|||
intl: ^0.19.0
|
||||
dio: ^5.7.0
|
||||
go_router: ^14.2.7
|
||||
flutter_screenutil: ^5.9.3
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user