用户单击箭头播放按钮后,将显示视频页面

时间:2020-04-16 19:03:50

标签: css user-interface flutter dart

当我尝试在on按下时创建if语句时发生错误,这是=>'平等运算符'=='调用了不相关类型的引用这是我的代码,在文本中您将看到我想要的列表在onPressed方法中进行if陈述。当用户单击箭头播放按钮时,应该带您到电影页面。我想在if语句中使用列表,以便该应用知道我要在电影页面上显示哪个视频

<<<<<<<<<<<<<<<<the moudle_page>>>>>>>>>>>>>>>>>>>
final List<Movie> movies = [
  Movie(

    imageUrl: 'assets/images/5little.PNG',
    title: 'Five Little Monkeys',
    categories: 'Fantasy, Sci-fi',
    year: 2018,
    country: 'USA',
    length: 129,
    description:
        'Our friendly neighborhood Super Hero decides to join his best friends Ned, MJ, and the rest of the gang on a European vacation. However, Peter\'s plan to leave super heroics behind for a few weeks are quickly scrapped when he begrudgingly agrees to help Nick Fury uncover the mystery of several elemental creature attacks, creating havoc across the continent.',
    screenshots: [
      'assets/images/monkeys1.PNG',
      'assets/images/monkeys2.PNG',
      'assets/images/monkeys3.PNG',
    ],
  ),
  Movie(
    imageUrl: 'assets/images/twinklStar.PNG',
    title: 'Twinkl Twinkle Little Star',
    categories: 'Adventure, Family, Fantasy',
    year: 2018,
    country: 'USA',
    length: 100,
    description:
        'All Clara wants is a key - a one-of-a-kind key that will unlock a box that holds a priceless gift from her late mother. A golden thread, presented to her at godfather Drosselmeyer\'s annual holiday party, leads her to the coveted key-which promptly disappears into a strange and mysterious parallel world. It\'s there that Clara encounters a soldier named Phillip, a gang of mice and the regents who preside over three Realms: Land of Snowflakes, Land of Flowers, and Land of Sweets. Clara and Phillip must brave the ominous Fourth Realm, home to the tyrant Mother Ginger, to retrieve Clara\'s key and hopefully return harmony to the unstable world.',
    screenshots: [
      'assets/images/twinkl1.PNG',
      'assets/images/twinkl2.PNG',
      'assets/images/twinkl3.PNG',
    ],
  ),
  Movie(

    imageUrl: 'assets/images/johnyjohny.PNG',
    title: 'Johny Johny Yes Papa',
    categories: 'Adventure, Fantasy',
    year: 2019,
    country: 'USA',
    length: 100,
    description:
        'Woody, Buzz Lightyear and the rest of the gang embark on a road trip with Bonnie and a new toy named Forky. The adventurous journey turns into an unexpected reunion as Woody\'s slight detour leads him to his long-lost friend Bo Peep. As Woody and Bo discuss the old days, they soon start to realize that they\'re two worlds apart when it comes to what they want from life as a toy.',
    screenshots: [
      'assets/images/johny1.PNG',
      'assets/images/johny2.PNG',
      'assets/images/johny3.PNG',
    ],
  ),

];


<<<<<<<<<<<<<<<<<<<<the movie page>>>>>>>>>>>>>>>>>.
  Positioned.fill(

                bottom: 10.0,
                child: Align(
                  alignment: Alignment.bottomCenter,

                  child: RawMaterialButton(

                    padding: EdgeInsets.all(10.0),
                    elevation: 12.0,


                    ///<<<<<<<<<<<<<<<< Video play here >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                    onPressed: () {  if(Movie()==movies[0])
                       {
                        Navigator.pushNamed(context, '/video');

                      }else{
                      print('Did 000swork');
                    }
                      },
                    shape: CircleBorder(),
                    fillColor: Colors.white,
                    child: Icon(


                      Icons.play_arrow,
                      size: 60.0,
                      color: Colors.purple,
                    ),
                  ),
                ),
              ),
              Positioned(
                bottom: 0.0,
                left: 20.0,
                child: IconButton(
                  onPressed: () => print('Add to My List'),
                  icon: Icon(Icons.add),
                  iconSize: 40.0,
                  color: Colors.black,
                ),
              ),
<<<<<<<<<<<<<<<<<<<<<<home page >>>>>>>>>>>>>>>

 leading: IconButton(
          padding: EdgeInsets.only(left: 30.0),
          onPressed: () => print('Menu'),
          icon: Icon(Icons.menu),
          iconSize: 30.0,
          color: Colors.black,
        ),
        actions: <Widget>[
          IconButton(
            padding: EdgeInsets.only(right: 30.0),
            onPressed: () => print('Search'),
            icon: Icon(Icons.search),
            iconSize: 30.0,
            color: Colors.black,
          ),
        ],
      ),
      body: ListView(
        children: <Widget>[
          Container(
            height: 280.0,
            width: double.infinity,
            child: PageView.builder(
            controller: _pageController,
            itemCount: movies.length,
            itemBuilder: (BuildContext context, int index) {
              return _movieSelector(index);
            },
          ),
          ),

0 个答案:

没有答案