จัดวางตำแหน่งของ flutter

ผมอยากให้ Textfield คำว่า Team A กับ Team B มันอยู่ข้างกันอะครับ
ผมลองใช้ Row แล้วมัน error มันพอมีวิธีอื้นไหมครับที่จะให้อยู่ข้างกันแบบตามที่ผมออกแบบ

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
        child: Column(children: <Widget>[
          SizedBox(height: 20,),
               Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextField(
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_A_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),
              ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextField(
              decoration: InputDecoration(
                /*labelText: Team_A_Name,
                        labelStyle: TextStyle(fontSize: 24,
                            color: Colors.red,
                            fontStyle: FontStyle.normal
                        ),*/
                hintText: "$Team_B_Name",
                hintStyle: TextStyle(fontSize: 24, color: Colors.indigo),
                border: InputBorder.none,
              ),
              obscureText: false,
              maxLength: 20,
              maxLines: 2,
              textInputAction: TextInputAction.done,
              controller: TeamB,
              style: TextStyle(
                  fontSize: 24,
                  color: Colors.white
              ),
            ),
          ),
        ]

        ),
      ),
    );
  }
}

ตอนนี้ที่มันเป็น

ลองดูว่าเป็นไง

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
          SizedBox(height: 20,),
          Row(
        child: Column(children: <Widget>[
          
               Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextField(
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_A_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),
              ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextField(
              decoration: InputDecoration(
                /*labelText: Team_A_Name,
                        labelStyle: TextStyle(fontSize: 24,
                            color: Colors.red,
                            fontStyle: FontStyle.normal
                        ),*/
                hintText: "$Team_B_Name",
                hintStyle: TextStyle(fontSize: 24, color: Colors.indigo),
                border: InputBorder.none,
              ),
              obscureText: false,
              maxLength: 20,
              maxLines: 2,
              textInputAction: TextInputAction.done,
              controller: TeamB,
              style: TextStyle(
                  fontSize: 24,
                  color: Colors.white
              ),
            ),
          ),
        ]
        ), //Row

        ),
      ),
    );
  }
}

errorตรง2บรรทัดนี้อะครับผมเอาออกถึงหายerror

image

runแล้วได้แบบนี้ครับ

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
          primarySwatch: Colors.blue,
          backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
        child: Row
          (children: <Widget>[

              Column(
                children: [
                  Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextField(
                    decoration: InputDecoration(
                      /*labelText: Team_A_Name,
                          labelStyle: TextStyle(fontSize: 24,
                              color: Colors.red,
                              fontStyle: FontStyle.normal
                          ),*/
                      hintText: "$Team_A_Name",
                      hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                      border: InputBorder.none,
                    ),
                    obscureText: false,
                    maxLength: 20,
                    maxLines: 2,
                    textInputAction: TextInputAction.done,
                    controller: TeamA,style: TextStyle(fontSize: 24),
                  ),
            ),
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: TextField(
                      decoration: InputDecoration(
                        hintText: "$Team_B_Name",
                        hintStyle: TextStyle(fontSize: 24, color: Colors.indigo),
                        border: InputBorder.none,
                      ),
                      obscureText: false,
                      maxLength: 20,
                      maxLines: 2,
                      textInputAction: TextInputAction.done,
                      controller: TeamB,
                      style: TextStyle(
                          fontSize: 24,
                          color: Colors.white
                      ),
                    ),
                  ),

                ],
              ),

          ],

          ),
      ),
    //Row

        );


  }
}

ผมลองแก้เป็นแบบนี้แล้วมันเป็นแบบนี้อะครับ

Errorที่ขึ้น

Performing hot reload...
Syncing files to device Android SDK built for x86...

======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
An InputDecorator, which is typically created by a TextField, cannot have an unbounded width.
This happens when the parent widget does not provide a finite width constraint. For example, if the InputDecorator is contained by a Row, then its width must be constrained. An Expanded widget or a SizedBox can be used to constrain the width of the InputDecorator or the TextField that contains it.
'package:flutter/src/material/input_decorator.dart':
Failed assertion: line 948 pos 7: 'layoutConstraints.maxWidth < double.infinity'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was: 
  TextField file:///C:/Users/Admin/background/lib/main.dart:50:26
When the exception was thrown, this was the stack: 
#2      _RenderDecoration._layout (package:flutter/src/material/input_decorator.dart:948:7)
#3      _RenderDecoration.performLayout (package:flutter/src/material/input_decorator.dart:1294:44)
#4      RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7)
#5      RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#6      RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7)
...
The following RenderObject was being processed when the exception was fired: _RenderDecoration#bebd3 relayoutBoundary=up9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...  parentData: <none> (can use size)
...  constraints: BoxConstraints(unconstrained)
...  size: MISSING
RenderObject: _RenderDecoration#bebd3 relayoutBoundary=up9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
  parentData: <none> (can use size)
  constraints: BoxConstraints(unconstrained)
  size: MISSING
...  input: RenderRepaintBoundary#237fc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    needs compositing
...    parentData: offset=Offset(0.0, 0.0)
...    constraints: MISSING
...    size: MISSING
...    usefulness ratio: no metrics collected yet (never painted)
...    child: RenderMouseRegion#3ac52 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: <none>
...      constraints: MISSING
...      size: MISSING
...      listeners: <none>
...      child: RenderRepaintBoundary#d5961 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        needs compositing
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        usefulness ratio: no metrics collected yet (never painted)
...        child: RenderCustomPaint#a8ca0 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...  hint: RenderAnimatedOpacity#60007 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0)
...    constraints: MISSING
...    size: MISSING
...    opacity: AnimationController#cb272(⏮ 0.000; paused; for AnimatedOpacity)➩Cubic(0.40, 0.00, 0.20, 1.00)➩Tween<double>(1.0 → null)➩1.0
...    alwaysIncludeSemantics
...    child: RenderParagraph#3dec8 NEEDS-LAYOUT NEEDS-PAINT
...      parentData: <none>
...      constraints: MISSING
...      size: MISSING
...      textAlign: start
...      textDirection: ltr
...      softWrap: wrapping at box width
...      overflow: ellipsis
...      locale: en_US
...      maxLines: 2
...      text: TextSpan
...        debugLabel: ((((englishLike subhead 2014).merge(blackMountainView subtitle1)).merge(unknown)).copyWith).merge(unknown)
...        inherit: false
...        color: MaterialColor(primary value: Color(0xfff44336))
...        family: Roboto
...        size: 24.0
...        weight: 400
...        baseline: alphabetic
...        decoration: TextDecoration.none
...        "Team Name"
...  helperError: RenderConstrainedBox#56202 NEEDS-LAYOUT NEEDS-PAINT
...    parentData: offset=Offset(0.0, 0.0)
...    constraints: MISSING
...    size: MISSING
...    additionalConstraints: BoxConstraints(unconstrained)
...  counter: RenderSemanticsAnnotations#40898 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...    parentData: offset=Offset(0.0, 0.0)
...    constraints: MISSING
...    semantic boundary
...    size: MISSING
...    child: RenderSemanticsAnnotations#315dd NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...      parentData: <none>
...      constraints: MISSING
...      size: MISSING
...      child: RenderExcludeSemantics#43364 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
...        parentData: <none>
...        constraints: MISSING
...        size: MISSING
...        excluding: true
...        child: RenderParagraph#ac6de NEEDS-LAYOUT NEEDS-PAINT
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...          textAlign: start
...          textDirection: ltr
...          softWrap: wrapping at box width
...          overflow: ellipsis
...          locale: en_US
...          maxLines: unlimited
...  container: RenderCustomPaint#1f744 NEEDS-LAYOUT NEEDS-PAINT
...    parentData: offset=Offset(0.0, 0.0)
...    constraints: MISSING
...    size: MISSING
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: _RenderDecoration#bebd3 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  TextField file:///C:/Users/Admin/background/lib/main.dart:50:26
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderPointerListener#76bb4 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  TextField file:///C:/Users/Admin/background/lib/main.dart:50:26
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderSemanticsAnnotations#76745 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  TextField file:///C:/Users/Admin/background/lib/main.dart:50:26
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderIgnorePointer#9dac5 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  TextField file:///C:/Users/Admin/background/lib/main.dart:50:26
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderMouseRegion#177e7 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  Padding file:///C:/Users/Admin/background/lib/main.dart:48:19
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderPadding#9c1f3 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  Column file:///C:/Users/Admin/background/lib/main.dart:46:15
====================================================================================================

======== Exception caught by rendering library =====================================================
RenderBox was not laid out: RenderFlex#9311e relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1920 pos 12: 'hasSize'
The relevant error-causing widget was: 
  Row file:///C:/Users/Admin/background/lib/main.dart:43:16
====================================================================================================

======== Exception caught by rendering library =====================================================
'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 341 pos 12: 'child!.hasSize': is not true.
The relevant error-causing widget was: 
  Center file:///C:/Users/Admin/background/lib/main.dart:42:13
====================================================================================================
Reloaded 1 of 536 libraries in 1,812ms.

======== Exception caught by rendering library =====================================================
The following _CastError was thrown during paint():
Null check operator used on a null value

The relevant error-causing widget was: 
  Row file:///C:/Users/Admin/background/lib/main.dart:43:16
When the exception was thrown, this was the stack: 
#0      RenderFlex._hasOverflow (package:flutter/src/rendering/flex.dart:489:37)
#1      RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:10)
#2      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2315:7)
#3      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#4      RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:72:15)
...
The following RenderObject was being processed when the exception was fired: RenderFlex#82887 relayoutBoundary=up2
...  needs compositing
...  parentData: offset=Offset(0.0, 0.0) (can use size)
...  constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=820.6)
...  size: MISSING
...  direction: horizontal
...  mainAxisAlignment: start
...  mainAxisSize: max
...  crossAxisAlignment: center
...  textDirection: ltr
...  verticalDirection: down
RenderObject: RenderFlex#82887 relayoutBoundary=up2
  needs compositing
  parentData: offset=Offset(0.0, 0.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=820.6)
  size: MISSING
  direction: horizontal
  mainAxisAlignment: start
  mainAxisSize: max
  crossAxisAlignment: center
  textDirection: ltr
  verticalDirection: down
...  child 1: RenderFlex#9311e relayoutBoundary=up3 NEEDS-PAINT
...    needs compositing
...    parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...    constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=820.6)
...    size: MISSING
...    direction: vertical
...    mainAxisAlignment: start
...    mainAxisSize: max
...    crossAxisAlignment: center
...    verticalDirection: down
...    child 1: RenderPadding#9c1f3 relayoutBoundary=up4 NEEDS-PAINT
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...      constraints: BoxConstraints(unconstrained)
...      size: MISSING
...      padding: EdgeInsets.all(8.0)
...      textDirection: ltr
...      child: RenderMouseRegion#177e7 relayoutBoundary=up5 NEEDS-PAINT
...        needs compositing
...        parentData: offset=Offset(8.0, 8.0) (can use size)
...        constraints: BoxConstraints(unconstrained)
...        size: MISSING
...        listeners: enter, exit
...        cursor: SystemMouseCursor(text)
...        child: RenderIgnorePointer#9dac5 relayoutBoundary=up6 NEEDS-PAINT
...          needs compositing
...          parentData: <none> (can use size)
...          constraints: BoxConstraints(unconstrained)
...          size: MISSING
...          ignoring: false
...          ignoringSemantics: implicitly false
...    child 2: RenderPadding#9aaf9 NEEDS-LAYOUT NEEDS-PAINT
...      needs compositing
...      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
...      constraints: MISSING
...      size: MISSING
...      padding: EdgeInsets.all(8.0)
...      textDirection: ltr
...      child: RenderMouseRegion#b7c55 NEEDS-LAYOUT NEEDS-PAINT
...        needs compositing
...        parentData: offset=Offset(0.0, 0.0)
...        constraints: MISSING
...        size: MISSING
...        listeners: enter, exit
...        cursor: SystemMouseCursor(text)
...        child: RenderIgnorePointer#d409c NEEDS-LAYOUT NEEDS-PAINT
...          needs compositing
...          parentData: <none>
...          constraints: MISSING
...          size: MISSING
...          ignoring: false
...          ignoringSemantics: implicitly false
====================================================================================================

ลองดูอันนี้

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
          SizedBox(height: 20,),
          Row(
        child: Column(children: <Widget>[
          
               Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextField(
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_A_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),
              ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextField(
              decoration: InputDecoration(
                /*labelText: Team_A_Name,
                        labelStyle: TextStyle(fontSize: 24,
                            color: Colors.red,
                            fontStyle: FontStyle.normal
                        ),*/
                hintText: "$Team_B_Name",
                hintStyle: TextStyle(fontSize: 24, color: Colors.indigo),
                border: InputBorder.none,
              ),
              obscureText: false,
              maxLength: 20,
              maxLines: 2,
              textInputAction: TextInputAction.done,
              controller: TeamB,
              style: TextStyle(
                  fontSize: 24,
                  color: Colors.white
              ),
            ),
          ),
        ],
        ), //Row

        ),
      ),
    );
  }
}

Run ไม่ได้อะครับ

ลบ Row() ออก ใส่ alignment ให้มัน

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
          SizedBox(height: 20,),
        child: Column(children: <Widget>[
          
               Padding(
                padding: const EdgeInsets.all(8.0),
                alignment: Alignment.topLeft,
                child: TextField(
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_A_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),
              ),
          Padding(
            padding: const EdgeInsets.all(8.0),
            alignment: Alignment.topRight,
            child: TextField(
              decoration: InputDecoration(
                /*labelText: Team_A_Name,
                        labelStyle: TextStyle(fontSize: 24,
                            color: Colors.red,
                            fontStyle: FontStyle.normal
                        ),*/
                hintText: "$Team_B_Name",
                hintStyle: TextStyle(fontSize: 24, color: Colors.indigo),
                border: InputBorder.none,
              ),
              obscureText: false,
              maxLength: 20,
              maxLines: 2,
              textInputAction: TextInputAction.done,
              controller: TeamB,
              style: TextStyle(
                  fontSize: 24,
                  color: Colors.white
              ),
            ),
          ),
        ]

        ),
      ),
    );
  }
}

ย้าย Sizebox กลับมาไว้ที่เดิมด้วย

ภาพ

1 Like

ได้แบบนี้อะครับ



import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black38,
      /*appBar: AppBar(
        title: Text("TimeCountDown"),
        backgroundColor: Colors.white54,
      ),*/
      body: Center(
          SizedBox(height: 20,),
        child: Column(children: <Widget>[
          
               Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextField1(
                 alignment: Alignment.topLeft,
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_A_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),
                child: TextField2(
                 alignment: Alignment.topRight,
                  decoration: InputDecoration(
                     /*labelText: Team_A_Name,
                      labelStyle: TextStyle(fontSize: 24,
                          color: Colors.red,
                          fontStyle: FontStyle.normal
                      ),*/
                    hintText: "$Team_B_Name",
                    hintStyle: TextStyle(fontSize: 24, color: Colors.red),
                    border: InputBorder.none,
                  ),
                  obscureText: false,
                  maxLength: 20,
                  maxLines: 2,
                  textInputAction: TextInputAction.done,
                  controller: TeamA,style: TextStyle(fontSize: 24),
                ),

              ),
         
        ]

        ),
      ),
    );
  }
}

:thinking:

ก็กันเข้าไปใหญ่ เทพ flutter ต้องมาแล้วครับ @nv_kku

อันนี้codeปัจจุบันที่ผมเขียนต่อจากอันบนแต่ก็ยังเอาTextfiledไปอยู่ข้างกันไม่ได้ :sob:

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart';

void main() {
  runApp(MyApp());
 //runApp(imageTeam());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // is not restarted.
        primarySwatch: Colors.blue,
        backgroundColor: Colors.black38
      ),
      //home: MainPage(),
      home: imageTeam(),

    );
  }
}


class imageTeam extends StatefulWidget {
  @override
  _imageTeamState createState() => _imageTeamState();

}

class _imageTeamState extends State<imageTeam> {
  final title = "ScoreDy";
  final Team_A_Name = "Team Name";
  final Team_B_Name = "Team Name";
  TextEditingController TeamA = TextEditingController(text: "");
  TextEditingController TeamB = TextEditingController(text: "");
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white54,
      appBar: AppBar(
        backgroundColor: Colors.black12,
        title:Text(title),
        centerTitle: true,
        titleTextStyle:
        TextStyle(
          fontSize: 50,
          fontWeight: FontWeight.bold,
        ),
      ),


      body: Builder(
        builder: (context)=> Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Row(
                children: [
                    Column(
                      children: [
                        Align(
                          alignment: Alignment.topLeft,
                          child: Padding(
                            padding: const EdgeInsets.only(
                                left: 20.0,
                                top: 20.0),
                            child: CircleAvatar(
                              radius: 80,
                            ),
                          ),
                        ),],
                    ),



                Align(
                  alignment: Alignment.topRight,
                  child: Padding(
                    padding: const EdgeInsets.only(
                        left: 50.0,
                        right: 20.0,
                        top: 20.0,
                    ),
                    child: CircleAvatar(
                      radius: 80,
                    ),
                  ),
                ),],
              ),


               SizedBox(height: 30,),


               Column(
                        children: [
                          Align(
                     alignment: Alignment.center,
                           child: Padding(
                            padding: const EdgeInsets.only(
                                left: 35.0,
                                right: 30,
                            ),
                            child: TextField(
                              decoration: InputDecoration(
                                /*labelText: Team_A_Name,
                                    labelStyle: TextStyle(fontSize: 24,
                                        color: Colors.red,
                                        fontStyle: FontStyle.normal
                                    ),*/
                                hintText: "$Team_A_Name",
                                hintStyle: TextStyle(
                                    fontSize: 24,
                                    color: Colors.red
                                ),
                                border: InputBorder.none,
                              ),
                                controller: TeamA,style: TextStyle(
                                fontSize: 24,
                                fontWeight: FontWeight.bold,
                                color: Colors.red
                            ),
                            ),
                          ),
                       ),

                        Align(
                          alignment: Alignment.centerRight,
                          child: Padding(
                            padding: const EdgeInsets.only(
                                right: 30.0,
                                left: 230.0
                            ),
                            child: TextField(
                     decoration: InputDecoration(
                       /*labelText: Team_B_Name,
                            labelStyle: TextStyle(fontSize: 24,
                                color: Colors.red,
                                fontStyle: FontStyle.normal
                            ),*/
                       hintText: "$Team_B_Name",
                       hintStyle: TextStyle(
                           fontSize: 24,
                           color: Colors.indigo,
                           ),
                       border: InputBorder.none,
                           ),
                              maxLines: 2,
                              controller: TeamB,
                              style: TextStyle(
                                fontSize: 24,
                                fontWeight: FontWeight.bold,
                                color: Colors.indigo,
                              ),
                            ),
                          ),
                        ),],
               ),



          ],
         ),
        ),
      ),
    );
  }
}