Exemplo n.º 1
0
 void _showShareView(IEvent eventObj)
 {
     ActionSheetUtils.showModalActionSheet(
         new ShareView(
             projectType: ProjectType.iEvent,
             onPressed: type => {
         AnalyticsManager.ClickShare(shareType: type, "Event", "Event_" + eventObj.id,
                                     title: eventObj.title);
         var linkUrl = CStringUtils.JointEventShareLink(eventId: eventObj.id);
         var path    = CStringUtils.CreateMiniPath(id: eventObj.id, title: eventObj.title);
         if (type == ShareType.clipBoard)
         {
             this.widget.actionModel.copyText(obj: linkUrl);
             CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
         }
         else
         {
             var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: eventObj.avatar);
             CustomDialogUtils.showCustomDialog(
                 child: new CustomLoadingDialog()
                 );
             this.widget.actionModel.shareToWechat(
                 arg1: type,
                 arg2: eventObj.title,
                 arg3: eventObj.shortDescription,
                 arg4: linkUrl,
                 arg5: imageUrl,
                 arg6: path)
             .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
             .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
         }
     }
             )
         );
 }
        Widget _buildHeadTop(IEvent eventObj, BuildContext context)
        {
            Widget shareWidget = new CustomButton(
                onPressed: () => ActionSheetUtils.showModalActionSheet(new ShareView(
                                                                           projectType: ProjectType.iEvent,
                                                                           onPressed: type => {
                AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title);

                var linkUrl = CStringUtils.JointEventShareLink(eventId: eventObj.id);
                if (type == ShareType.clipBoard)
                {
                    this.widget.actionModel.copyText(linkUrl);
                    CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline);
                }
                else
                {
                    var imageUrl = CImageUtils.SizeTo200ImageUrl(eventObj.avatar);
                    CustomDialogUtils.showCustomDialog(
                        child: new CustomLoadingDialog()
                        );
                    this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription,
                                                          linkUrl,
                                                          imageUrl, null).Then(CustomDialogUtils.hiddenCustomDialog)
                    .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
                }
            })),
                child: new Container(
                    color: CColors.Transparent,
                    child: new Icon(Icons.share, size: 24,
                                    color: this._showNavBarShadow ? CColors.White : CColors.Icon))
                );

            Widget titleWidget = new Container();

            if (this._isHaveTitle)
            {
                titleWidget = new Text(
                    eventObj.title,
                    style: CTextStyle.PXLargeMedium,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    textAlign: TextAlign.center
                    );
            }

            return(new AnimatedContainer(
                       height: 44 + CCommonUtils.getSafeAreaTopPadding(context: context),
                       duration: TimeSpan.Zero,
                       padding: EdgeInsets.only(8, right: 8, top: CCommonUtils.getSafeAreaTopPadding(context: context)),
                       decoration: new BoxDecoration(
                           CColors.White,
                           border: new Border(
                               bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)),
                           gradient: this._showNavBarShadow
                        ? new LinearGradient(
                               colors: new List <Color> {
                new Color(0x80000000),
                new Color(0x0)
            },
                               begin: Alignment.topCenter,
                               end: Alignment.bottomCenter
                               )
                        : null
                           ),
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new CustomButton(
                    onPressed: () => this.widget.actionModel.mainRouterPop(),
                    child: new Icon(
                        Icons.arrow_back,
                        size: 24,
                        color: this._showNavBarShadow ? CColors.White : CColors.Icon
                        )
                    ),
                new Expanded(
                    child: new Stack(
                        fit: StackFit.expand,
                        children: new List <Widget> {
                    new PositionedTransition(
                        rect: this._animation,
                        child: titleWidget
                        )
                }
                        )
                    ),
                shareWidget
            }
                           )
                       ));
        }