how add labeltext to the container in flutter
realNameHidden
Posted on April 5, 2023
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Home(),
debugShowCheckedModeBanner: false,
);
}
}
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
height: 100,
width: 400,
child: InputDecorator(
decoration: InputDecoration(
labelText: 'Box',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
)),
child: Text("Container Content"),
),
),
),
);
}
}
๐ ๐ช ๐
๐ฉ
realNameHidden
Posted on April 5, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.