dimanche 31 mars 2019

Implement Widget testing

I'm pretty noob in testing and don't know how to implement widget testing for the following flutter code. thanks in advance.

code description: I have made a slideshow using carousal widget and a button using inkwell this button simply directs to the next screen.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

import 'package:flutter/material.dart';
import 'package:baseball/ui/phone/phone_page.dart';
import 'package:carousel_pro/carousel_pro.dart';
import 'package:flutter/services.dart';
import './splash_widgets.dart';

class SplashPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitDown,
      DeviceOrientation.portraitUp,
    ]);
    return Container(
      child: Scaffold(
        appBar:PreferredSize(
        preferredSize: Size.fromHeight(60.0),
    child: Appbar()),
        body: Center(
          child: Column(
            children: <Widget>[
              Expanded(
      child: Carousel(
        images: [
          AssetImage('images/SlideImage_1.jpg'),
          AssetImage('images/SlideImage_2.jpg'),
          AssetImage('images/SlideImage_3.jpg'),
        ],
        animationCurve: Curves.fastOutSlowIn,
        animationDuration: Duration(milliseconds: 2000),
      ),
    ),
              SizedBox(
      height: 70,

      width: double.infinity,
      // height: double.infinity,
      child: InkWell(
        onTap: () => Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => Phone()),
            ),
        child: new Container(
          //width: 100.0,
          height: 50.0,
          decoration: new BoxDecoration(
            color: Theme.of(context).buttonColor,
          ),
          child: new Center(
            child: new Text(
              'GET STARTED',
              style: Theme.of(context).textTheme.button,
            ),
          ),
        ),
      ),
    )
            ],
          ),
        ),
      ),
    );
  }
}```





Aucun commentaire:

Enregistrer un commentaire