Skip to content

Instantly share code, notes, and snippets.

@pratikbutani
Last active October 16, 2022 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratikbutani/1e9de65ff62acacfe2611706c5eb7246 to your computer and use it in GitHub Desktop.
Save pratikbutani/1e9de65ff62acacfe2611706c5eb7246 to your computer and use it in GitHub Desktop.
Change color of border & IconData in TextInput

Change color of border & IconData in TextInput

Created with <3 with dartpad.dev.

import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData().copyWith(
scaffoldBackgroundColor: Colors.white,
colorScheme: ThemeData().colorScheme.copyWith(primary: Colors.green),
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: MyWidget(),
),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outline),
hintText: 'Username',
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment