Giter Site home page Giter Site logo

Next/Complete Button about circle_indicator HOT 10 CLOSED

long1eu avatar long1eu commented on September 27, 2024
Next/Complete Button

from circle_indicator.

Comments (10)

long1eu avatar long1eu commented on September 27, 2024 1

Done, you can check it now.

from circle_indicator.

Solido avatar Solido commented on September 27, 2024 1

Tested and it works great 👍

from circle_indicator.

long1eu avatar long1eu commented on September 27, 2024

Thanks! Good point. In my project I do use a widget to navigate to another page. I'll add that right away. A name constructor would be fine?

from circle_indicator.

long1eu avatar long1eu commented on September 27, 2024

🤣 so I don't think I can integrate it in the Circle Widget. In my project I add it to the main page logic like this:

class StartPage extends StatefulWidget {

  @override
  State<StatefulWidget> createState() => new _StartPageState();

}

class _StartPageState extends State<StartPage> {

  final PageController controller = new PageController();

  Stack rootWidget;
  bool showStart = false;
  int previousPage = 0;

  @override
  Widget build(BuildContext context) {
    rootWidget = createPages();
    controller.addListener(pagerListener);

    return new Scaffold(
      body: new Container(
        padding: new EdgeInsets.only(top: 16.0,),
        decoration: new BoxDecoration(
            color: primaryColor
        ),
        child: rootWidget,
      ),
    );
  }

  Stack createPages() {
    var pageList = <StartPageItem>[
      new StartPageItem("assets/ic_info_01.png"),
      new StartPageItem("assets/ic_info_02.png"),
      new StartPageItem("assets/ic_info_03.png"),
      new StartPageItem("assets/ic_info_04.png"),
      new StartPageItem("assets/ic_info_05.png"),
      new StartPageItem("assets/ic_info_06.png"),
      new StartPageItem("assets/ic_info_07.png"),
      new StartPageItem("assets/ic_info_08.png"),
    ];

    var childrenList = <Widget>[
      new PageView.builder(
        controller: controller,
        itemCount: pageList.length,
        itemBuilder: (_, int i) => pageList[i],
      ),
      new Container(
        margin: new EdgeInsets.only(
          top: 16.0,
          bottom: 16.0,
        ),
        child: new CircleIndicator(
            controller, pageList.length, 3.0,
            Colors.white70, Colors.white),
      ),
    ];


    if (showStart) {
      childrenList.add(
        new Container(
          alignment: FractionalOffset.bottomRight,
          margin: new EdgeInsets.all(16.0),
          child: new GestureDetector(
            onTap: startApp,
            child: new Text("START",
              style: Theme
                  .of(context)
                  .textTheme
                  .body1
                  .copyWith(
                color: Colors.white,
                fontFamily: "DancingScript-Regular",
              ),
            ),
          ),
        ),
      );
    }

    return new Stack(
      alignment: FractionalOffset.bottomCenter,
      children: childrenList,
    );
  }


  void pagerListener() {
    setState(() => showStart = controller.page == 7);
  }

  void startApp() {
    Navigator.popAndPushNamed(context, HomePage.routeName);
  }
}

from circle_indicator.

Solido avatar Solido commented on September 27, 2024

I guess you can provide the widget like you do now but also a global page wrapper

from circle_indicator.

Solido avatar Solido commented on September 27, 2024

Something like new IntroductionView and the constructor take the PageList and the final action as parameters

from circle_indicator.

long1eu avatar long1eu commented on September 27, 2024

ooo, nice, so you only need to provide the pages, ok

from circle_indicator.

Solido avatar Solido commented on September 27, 2024
new CircleIntroduction( <Widget>[], onComplete => // Fade or navigate somewhere else )

from circle_indicator.

long1eu avatar long1eu commented on September 27, 2024

perfect

from circle_indicator.

long1eu avatar long1eu commented on September 27, 2024

Can you close this issue?

from circle_indicator.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.