0

I have a form page. At the top of the page I write the name of the form. But the problem is that this name takes up a lot of space (height). Is it possible to reduce this height ?? My image:

enter image description here

My code

class Form_ttn extends StatefulWidget {
  @override
  _SettingsScreenState createState() => _SettingsScreenState();
}

class _SettingsScreenState extends State<Form_ttn> {
  bool lockInBackground = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('ТТН'), centerTitle: true,
        backgroundColor: Colors.blueGrey,),
      body: SingleChildScrollView(
MaksIngenr
  • 61
  • 9
  • See this: https://stackoverflow.com/questions/51089994/flutter-setting-the-height-of-the-appbar – Amir Nov 03 '21 at 11:40

3 Answers3

0

You can make a custom appbar using PreferredSize widget.

return Scaffold(
      appBar: CustomAppBar(height: 50....

...

PreferredSize CustomAppBar({
  BoxDecoration decoration,
  EdgeInsets padding,
  Widget child,
  double height,
}) {
  return PreferredSize(
    preferredSize: Size.fromHeight(height),

    child: Container(
      padding: padding,
      decoration: decoration,
      child: child
      ),
  );
}
KuKu
  • 6,654
  • 1
  • 13
  • 25
0

Try to use SafeArea widget ,refer below code hope its help to you. refer SafeArea here

 return SafeArea(
  child: Scaffold(
    appBar: AppBar(
      centerTitle: true,
      title: Text(
        'Search Here',
      ),
        ),
    body: SingleChildScrollView(),
  ),
);

Your result screen-> image

Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
0

Set height using toolbarHeight in AppBar

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 03 '21 at 14:28