To develop an APP to explain the use of relevant knowledge.

Create a Flutter Application using AndroidStudio

Create a Splash page

Generally open screen, is to show a picture.

  1. Loading ways of the picture book. Flutterchina. Club/chapter3 / im…

    Local image

  • You need to set the image path first. pubspec.yaml assets: – assets/images/splash_bg.png
  • To create the Image
Image(
      image: AssetImage("assets/images/splash_bg.png"), width: double infinity / / mandatory hold full height on width: color: fit: / / zoom mode alignment: alignment. The center / / alignment);Copy the code

or

Image.asset("assets/images/splash_bg.png", width: 100.0)Copy the code
  1. Sometimes the layout does not require the image to be in full screen because zooming may distort the image. In this case, you can use a layer of Container to set the background.
return Container(
  color: Colors.blue,
  child: Image.asset(
    "assets/images/splash_bg.png",
    width: double.infinity,
    height: double.infinity,
    fit: BoxFit.contain,
    alignment: Alignment.center,
  ),
);
Copy the code

In Android, a blank page is launched. For solutions, see juejin.cn/post/684490…

  1. Delay jumping to the next page

Life cycle of State in Flutter

Segmentfault.com/a/119000001…

Flutter built-in function

Future.delayed(Duration(milliseconds: 500), () {
});
Copy the code

Or use Rxdart

Observable.just(1).delay(new Duration(milliseconds: 500)).listen((_) {
    });
Copy the code

3. Novice guide page Swiper

Swiper can be used with the wheel casting component that Flutter provides.

Github.com/best-flutte…

4. Switch Offstage between open screen and novice boot

You can display the open screen widget and the newbie boot widget on the same page, just switching the widgets separately.

You can display and hide control widgets yourself, or you can use the Offstage component that Flutter provides.

Source:

A widget that lays the child out as if it was in the tree, but without
painting anything, without making the child available for hit testing, and
without taking any room in the parent.

Animations continue to run in offstage children, and therefore use battery
and CPU time, regardless of whether the animations end up being visible.

[Offstage] can be used to measure the dimensions of a widget without
bringing it on screen (yet). To hide a widget from view while it is not
needed, prefer removing the widget from the tree entirely rather than
keeping it alive in an [Offstage] subtree.
Copy the code

The RenderOffstage does not show and hide by inserting or removing its own nodes in the Widget Tree, but by sizing itself, not responding to hittests, and not drawing. It is also recommended that widgets be removed if they do not need to be displayed.

Five, novice boot save

Use shared_preferences in the Flutter Plugin. Github.com/flutter/plu…