Initial commit: Penyerahan final Source code Tugas Akhir

This commit is contained in:
ferdiakhh
2025-07-10 19:15:14 +07:00
commit e1f2206b8a
687 changed files with 80132 additions and 0 deletions

View File

@ -0,0 +1,149 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:initial_folder/size_config.dart';
import 'package:initial_folder/theme.dart';
class CustomTextField extends StatelessWidget {
CustomTextField({
Key? key,
this.length = 999,
this.minLines = 1,
this.maxLines = 1,
this.height = 13,
this.noTitle = false,
this.prefix,
this.suffix,
this.color = secondaryColor,
this.borderColor = Colors.white,
this.keyboardType = TextInputType.text,
this.title = '',
this.obscuretext = false,
this.auto = false,
this.validate,
this.enable = true,
required this.pad,
required this.controler,
required this.hinttext,
this.textInputAction,
this.digitOnly,
}) : super(key: key);
final int length;
final Color color;
final bool? digitOnly;
final int minLines;
final int maxLines;
final bool noTitle;
final Color borderColor;
final TextInputType keyboardType;
final bool auto;
final String title;
final bool obscuretext;
final TextEditingController controler;
final String hinttext;
final double pad;
final double height;
final FormFieldValidator<String>? validate;
final Widget? prefix;
final Widget? suffix;
final TextInputAction? textInputAction;
final bool enable;
// final String val;
@override
Widget build(BuildContext context) {
final Brightness brightnessValue =
MediaQuery.of(context).platformBrightness;
bool isDarkMode = brightnessValue == Brightness.dark;
return Container(
margin: EdgeInsets.symmetric(horizontal: pad),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
noTitle == false
? Text(
title,
style: thirdTextStyle.copyWith(
fontWeight: semiBold,
fontSize: getProportionateScreenWidth(12),
// color: baruTexthitam,
letterSpacing: 0.5),
)
: SizedBox(height: 0),
noTitle == false
? SizedBox(
height: getProportionateScreenHeight(4),
)
: SizedBox(height: 0),
Theme(
data: ThemeData.dark(),
child: TextFormField(
// initialValue: val,
onChanged: (value) {},
enabled: enable,
minLines: minLines,
maxLines: maxLines,
inputFormatters: [
(digitOnly != null)
? (digitOnly!)
? FilteringTextInputFormatter.digitsOnly
: LengthLimitingTextInputFormatter(length)
: LengthLimitingTextInputFormatter(length)
],
keyboardType: keyboardType,
// autofocus: auto,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: validate,
obscureText: obscuretext,
controller: controler,
style: primaryTextStyle.copyWith(
color: Theme.of(context).brightness == Brightness.dark
? baruTextutih
: baruTexthitam,
fontSize: getProportionateScreenWidth(14),
letterSpacing: 0.5,
),
cursorColor: secondaryColor,
decoration: InputDecoration(
filled: true,
fillColor: Theme.of(context).brightness == Brightness.dark
? seventeenColor
: secondaryColor.withOpacity(0.3),
// errorStyle: primaryTextStyle,
// errorBorder: OutlineInputBorder(
// borderSide: BorderSide(color: sevenColor),
// borderRadius: BorderRadius.circular(10)),
errorStyle: thirdTextStyle.copyWith(color: Colors.red),
suffixIcon: suffix,
prefixIcon: prefix,
contentPadding: EdgeInsets.only(
left: getProportionateScreenWidth(15),
top: getProportionateScreenHeight(height),
bottom: getProportionateScreenHeight(height)),
hintText: hinttext,
hintStyle: thirdTextStyle.copyWith(
fontSize: getProportionateScreenWidth(12),
color: color,
letterSpacing: 0.5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
10,
),
borderSide: BorderSide.none),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
10,
),
borderSide: BorderSide.none),
),
textInputAction: textInputAction,
),
),
SizedBox(
height: getProportionateScreenHeight(16),
),
],
),
);
}
}