import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; // 邀请好友 class InvitedFriendsPage extends StatefulWidget { final Map model; const InvitedFriendsPage(this.model, {Key key}) : super(key: key); @override _InvitedFriendsPageState createState() => _InvitedFriendsPageState(); } class _InvitedFriendsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: _createNav(), backgroundColor: Colors.redAccent, body: Column( children: [ Expanded( child: _createSwiper(), ), _createTeacher(), _createBottom(), ], ), ); } // 导航栏 Widget _createNav() { return CupertinoNavigationBar( border: Border( bottom: BorderSide( width: 0.0, // One physical pixel. style: BorderStyle.none, ), ), backgroundColor: Colors.white, leading: Navigator.canPop(context) ? GestureDetector( child: Container( padding: EdgeInsets.zero, child: Icon( Icons.arrow_back_ios, size: 20, ), ), onTap: () { if (Navigator.canPop(context)) { Navigator.pop(context); } }, ) : Container(), middle: Text( '邀请好友', style: TextStyle( fontSize: 15, color: HexColor.fromHex('#333333'), ), ), trailing: Text( '规则', style: TextStyle( fontSize: 15, color: HexColor.fromHex('#333333'), ), ), ); } Widget _createSwiper() { return Container( width: double.infinity, child: Swiper( itemBuilder: (BuildContext context, int index) { return new Image.network( "http://via.placeholder.com/288x188", fit: BoxFit.fill, ); }, itemCount: 10, viewportFraction: 0.8, scale: 0.9, ), ); } Widget _createTeacher() { return Container( width: double.infinity, margin: EdgeInsets.only(top: 20, left: 30, right: 30), padding: EdgeInsets.only(left: 13, right: 3), height: 36, decoration: BoxDecoration( color: Color(0x80ffffff), borderRadius: BorderRadius.circular(18), ), child: Row( children: [ Container( margin: EdgeInsets.only(right: 10), width: 18, height: 18, color: Colors.redAccent, ), Expanded( child: Text( '联系导师教你更多赚钱秘籍', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 13, color: Color(0xff333333), ), ), ), Container( width: 88, height: 30, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(15)), child: Center( child: Text( '联系导师', style: TextStyle( fontSize: 13, color: Color(0xff333333), ), ), ), ), ], ), ); } Widget _createBottom() { return SafeArea( top: false, child: Container( margin: EdgeInsets.all(12.5), padding: EdgeInsets.all(10), width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(18), boxShadow: [ BoxShadow( offset: Offset(0, 5), //x,y轴 color: Colors.black12.withOpacity(0.1), //投影颜色 blurRadius: 10 //,投影距离 ) ], ), child: Column( children: [ Row( children: List.generate(3, (index) { return Expanded( child: Container( margin: EdgeInsets.only(left: 8, right: 8), height: 28, decoration: BoxDecoration( color: Colors.redAccent, borderRadius: BorderRadius.circular(14), ), ), ); }), ), Padding( padding: EdgeInsets.only(top: 10), child: Text( '您的好友下载APP并使用的您的邀请码成功登录之后,Ta将成为您的粉丝,粉丝下单,您也可以获得收益哦!', style: TextStyle(fontSize: 13, color: Color(0xff999999)), ), ), ], ), ), ); } }