notube-export/lib/dlForm/formComponents/urlTextField.dart

37 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:notube/constants.dart';
import 'package:provider/provider.dart';
import 'package:notube/dlForm/cubit/dl_form_cubit.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class UrlTextField extends StatelessWidget {
const UrlTextField({super.key});
@override
Widget build(BuildContext context) {
return Flexible(
child: TextFormField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'search_url'.tr(),
filled: true,
fillColor: colorBackgroundBlack,
contentPadding: EdgeInsets.symmetric(
horizontal: 20,
),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
onChanged: (newUrl) {
context.read<DlFormCubit>().setUrl(newUrl);
},
),
);
}
}