flutter_titled_container 1.0.7 flutter_titled_container: ^1.0.7 copied to clipboard
This widget displayes a title on top of a Container. You can specify the title, alignment, titleColor, fontSize, background color for this to display.
import 'package:flutter/material.dart';
import 'package:flutter_titled_container/flutter_titled_container.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
centerTitle: true,
title: Text('Titled Container'),
),
body: Center(
child: TitledContainer(
titleColor: Colors.blue,
title: 'Center Title',
textAlign: TextAlignTitledContainer.Left,
fontSize: 14.0,
backgroundColor: Colors.white,
child: Container(
width: 250.0,
height: 200.0,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.blue,
),
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
),
child: Center(
child: Text(
'Center Align text',
style: TextStyle(fontSize: 28.0),
),
),
),
),
),
);
}
}