v1.0.7flutter_titled_container
此小部件在 Container 上方显示一个标题。您可以指定标题、对齐方式、标题颜色、字体大小以及背景颜色以进行显示。
22喜欢 155近 30 天下载150Pub 分数
AndroidiOSWebmacOSWindowsLinux
johandb/flutter_titled_container open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
Display a title on top of the Container.
The widget works best with a child container : Container
You can set the following properties :
See the screenshot

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: 'Container Title',
textAlign: TextAlignTitledContainer.Center,
fontSize: 16.0,
backgroundColor: Colors.white,
child: Container(
width: 250.0,
height: 200.0,
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue,
),
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
),
child: Center(
child: Text(
'Some text',
style: TextStyle(fontSize: 28.0),
),
),
),
),
),
);
}
}
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗