-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
in main dart return Scaffold Widget
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
SizedBox sziebox = new SizedBox(
width: 100.0,
height: 100.0,
child: new DecoratedBox(
decoration: new BoxDecoration(color: Colors.red),
),
);
return new Scaffold(
appBar: new AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: new Text(widget.title),
),
body: sziebox,
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}the red color size is 100*100,this is right .
the problem code:
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
SizedBox sziebox = new SizedBox(
width: 100.0,
height: 100.0,
child: new DecoratedBox(
decoration: new BoxDecoration(color: Colors.red),
),
);
return sziebox;
}the red color size fill the whole screen.why size is not 100 * 100??
this is right image
this is problem image
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.5.3-pre.21, on Microsoft Windows [Version 10.0.17134.48], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2018.1)
[√] Connected devices (1 available)
• No issues found!
ali-1989
Metadata
Metadata
Assignees
Labels
frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.

