2022-08-21 17:46:42 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:revanced_manager/theme.dart';
|
|
|
|
|
|
|
|
class CustomTextField extends StatelessWidget {
|
|
|
|
final TextEditingController inputController;
|
2022-09-02 15:35:25 +02:00
|
|
|
final Widget label;
|
2022-08-21 17:46:42 +02:00
|
|
|
final String hint;
|
|
|
|
final Function(String)? onChanged;
|
|
|
|
|
|
|
|
const CustomTextField({
|
|
|
|
Key? key,
|
|
|
|
required this.inputController,
|
|
|
|
required this.label,
|
|
|
|
required this.hint,
|
|
|
|
required this.onChanged,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2022-09-02 15:35:25 +02:00
|
|
|
children: <Widget>[
|
|
|
|
const SizedBox(height: 8),
|
2022-08-21 17:46:42 +02:00
|
|
|
TextField(
|
|
|
|
controller: inputController,
|
|
|
|
onChanged: onChanged,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
2022-09-02 15:35:25 +02:00
|
|
|
color: Theme.of(context).textTheme.headline5!.color,
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
cursorColor: Theme.of(context).textTheme.headline5!.color,
|
2022-08-21 17:46:42 +02:00
|
|
|
decoration: InputDecoration(
|
2022-09-02 15:35:25 +02:00
|
|
|
label: label,
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: isDark ? Colors.grey[300] : Colors.black,
|
|
|
|
),
|
2022-08-21 17:46:42 +02:00
|
|
|
filled: true,
|
|
|
|
fillColor: Theme.of(context).colorScheme.primary,
|
|
|
|
hintText: hint,
|
2022-09-02 15:35:25 +02:00
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: Colors.grey.withOpacity(.75),
|
|
|
|
),
|
|
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 0.0,
|
|
|
|
horizontal: 20.0,
|
|
|
|
),
|
2022-08-21 17:46:42 +02:00
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
|
|
width: 1.0,
|
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
borderRadius: BorderRadius.circular(10),
|
2022-08-21 17:46:42 +02:00
|
|
|
gapPadding: 4.0,
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
width: 2.0,
|
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
borderRadius: BorderRadius.circular(10),
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
errorBorder: OutlineInputBorder(
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
color: Color(0xffEF4444),
|
|
|
|
width: 1.0,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
|
|
width: 1.0,
|
|
|
|
),
|
2022-09-02 15:35:25 +02:00
|
|
|
borderRadius: BorderRadius.circular(10),
|
2022-08-21 17:46:42 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|