这是我尝试过的:
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
gradient:
LinearGradient(colors: [Color(0xFFc2e59c), Color(0xFF64b3f4)]),
)
Run Code Online (Sandbox Code Playgroud)
我也尝试过不指定宽度和高度,但最终结果始终是一个不会完全填充主体的渐变 -
我正在使用flutter_native_splash包。我该如何修复这个错误?
\n\nPubspec.yaml -
\n\n cupertino_icons:\n\ndev_dependencies:\n flutter_test:\n sdk: flutter\n\nflutter_native_splash:\n image: assets/splash.png\n color: \xe2\x80\x9c6a1b9a\xe2\x80\x9d\n android: true\n fill: true\n\n# For information on the generic Dart part of this file, see the\n# following page: https://dart.dev/tools/pub/pubspec\n\n# The following section is specific to Flutter.\nflutter:\nRun Code Online (Sandbox Code Playgroud)\n\n错误:
\n\nPS C:\\Users\\project> flutter pub pub run flutter_native_splash: create\nCould not find package "flutter_native_splash". Did you forget to add a dependency?\nRun Code Online (Sandbox Code Playgroud)\n