Flutter-包含图像和文本的pageView对齐问题

时间:2018-11-01 05:31:05

标签: flutter pageviews

new ConstrainedBox(
        constraints: const BoxConstraints.expand(),
        child: Column(
          children: <Widget>[
            Container(
              height: 420.0,
              width: MediaQuery.of(context).size.width,
              decoration: BoxDecoration(
                image: DecorationImage(
                  fit: BoxFit.cover,
                  image: AssetImage("lib/assets/onboarding1@3x.png"),
                ),
              ),
            ),
            Container(
              height: 80,
              padding: EdgeInsets.only(top: 20.0),
              margin: EdgeInsets.only(top: 20.0),
              child: Column(
                children: <Widget>[
                  Flexible(
                    child: Text(
                      S.of(context).welcome,
                      style: TextStyle(
                          fontSize: 17.0, fontWeight: FontWeight.bold),
                    ),
                  ),
                  Flexible(
                    child: Text(
                      S.of(context).line1,
                    ),
                  ),
                  Flexible(
                    child: Text(
                      S.of(context).line2,
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),


 ),
        child: new Stack(
          alignment: Alignment(0.0, 0.0),
          children: <Widget>[
            new PageView.builder(
              physics: new AlwaysScrollableScrollPhysics(),
              controller: _controller,
              itemBuilder: (BuildContext context, int index) {
                return _pages[index % _pages.length];
              },
            ),
            new Positioned(
              bottom: 1.0,
              left: 1.0,
              right: 1.0,
              child: new Container(
                padding: const EdgeInsets.all(20.0),
                child: new Center(
                  child: new DotsIndicator(
                    context: context,
                    controller: _controller,
                    itemCount: _pages.length,
                    onPageSelected: (int page) {
                      _controller.animateToPage(
                        page,
                        duration: _Duration,
                        curve: _Curve,
                      );`[![enter code here][1]][1]`

enter image description here

0 个答案:

没有答案