From 7651d5200767a339089dd4021bf77a86b6adcf80 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Mon, 11 Sep 2023 01:00:14 +0530 Subject: first commit --- lib/widgets/input_box.dart | 36 ++++++++++++++++++++++++++++++++++++ lib/widgets/snackbar.dart | 19 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 lib/widgets/input_box.dart create mode 100644 lib/widgets/snackbar.dart (limited to 'lib/widgets') diff --git a/lib/widgets/input_box.dart b/lib/widgets/input_box.dart new file mode 100644 index 0000000..c035635 --- /dev/null +++ b/lib/widgets/input_box.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +class FormInputBox extends StatefulWidget { + const FormInputBox({ + super.key, + //this.textInputType, + required this.controller, + this.hintText = "", + this.obscureText = false, + }); + + //final TextInputType textInputType; + final String hintText; + final TextEditingController controller; + final bool obscureText; + + @override + FormInputBoxState createState() => FormInputBoxState(); +} + +class FormInputBoxState extends State { + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), + child: TextFormField( + obscureText: widget.obscureText, + controller: widget.controller, + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: widget.hintText, + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/snackbar.dart b/lib/widgets/snackbar.dart new file mode 100644 index 0000000..8da41a1 --- /dev/null +++ b/lib/widgets/snackbar.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; + +class MySnackBar { + final String message; + + const MySnackBar({ + required this.message, + }); + + static show(BuildContext context, String message) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + behavior: SnackBarBehavior.floating, + width: 400.0, + ), + ); + } +} \ No newline at end of file -- cgit v1.2.3