GitHub repositoryjohandb/flutter_titled_container

flutter_titled_container

johandb/flutter_titled_container open-source repository details.

flutter_titled_container project cover
Stars
3
Forks
1
Last push (UTC)
May 28, 2021
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

flutter_titled_container

Display a title on top of the Container.

The widget works best with a child container : Container

You can set the following properties :

  • title - The text to display
  • titleColor - The color (foreground) fors title, default is black
  • fontSize - The font size for title, default is 14.0
  • backgroundColor - The background color for title, default is white
  • textAlign - The alignment for text. i.e. Lef, Center or Right

See the screenshot

Example

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),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Johan den Boer GitHub avatar
GitHub author

Johan den Boer ↗

I am a Java, IOS developer and Ethic Hacker. I develop in Java, IOS, Flutter, React, Angular, Tailwind, Bootstrap. Like to learn new technologies.

LanguagesDartSwiftKotlinObjective-C

Categories

Packages published by this repository

Dependencies used

Dependency list 2 items

  • flutter{"sdk":"flutter"}
  • flutter_testDevelopment{"sdk":"flutter"}

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗