Advertisement
fatalryuu

Untitled

Apr 1st, 2024
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.41 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class ProfileInput extends StatelessWidget {
  4.   final TextEditingController controller;
  5.   final String placeholder;
  6.   final bool isEditing;
  7.  
  8.   const ProfileInput({
  9.     super.key,
  10.     required this.controller,
  11.     required this.placeholder,
  12.     required this.isEditing,
  13.   });
  14.  
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     return Padding(
  18.         padding: const EdgeInsets.only(top: 14.0),
  19.         child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  20.           Padding(
  21.             padding: const EdgeInsets.only(left: 24.0),
  22.             child: Text(
  23.               placeholder,
  24.               style: const TextStyle(
  25.                 color: Colors.white,
  26.                 fontSize: 18.0,
  27.                 fontWeight: FontWeight.w500,
  28.               ),
  29.             ),
  30.           ),
  31.           const SizedBox(height: 10.0),
  32.           Padding(
  33.               padding: const EdgeInsets.symmetric(horizontal: 25.0),
  34.               child: SizedBox(
  35.                   width: MediaQuery.of(context).size.width * 0.8,
  36.                   child: Container(
  37.                     decoration: BoxDecoration(
  38.                       color: Colors.black,
  39.                       border: Border.all(
  40.                           color: isEditing ? Colors.white : Colors.grey,
  41.                           width: 2.0),
  42.                       borderRadius: BorderRadius.circular(8),
  43.                     ),
  44.                     child: Padding(
  45.                       padding: const EdgeInsets.only(left: 15.0),
  46.                       child: TextField(
  47.                         controller: controller,
  48.                         enabled: isEditing,
  49.                         decoration: InputDecoration(
  50.                           border: InputBorder.none,
  51.                           hintText: isEditing ? "Enter..." : "No data",
  52.                           hintStyle: const TextStyle(color: Colors.grey),
  53.                           contentPadding: const EdgeInsets.only(bottom: 5.0),
  54.                         ),
  55.                         cursorColor: Colors.white,
  56.                         style: const TextStyle(
  57.                             color: Colors.white,
  58.                             fontSize: 18.0,
  59.                             fontWeight: FontWeight.w500),
  60.                         autocorrect: false,
  61.                       ),
  62.                     ),
  63.                   )))
  64.         ]));
  65.   }
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement