Widget build()

in dashboard/lib/widgets/commit_box.dart [92:161]


  Widget build(BuildContext context) {
    final ThemeData theme = Theme.of(context);
    final RenderBox renderBox = parentContext.findRenderObject() as RenderBox;
    final Offset offsetLeft = renderBox.localToGlobal(Offset.zero);
    return Stack(
      children: <Widget>[
        // This is the area a user can click (the rest of the screen) to close the overlay.
        GestureDetector(
          onTap: closeCallback,
          child: Container(
            width: MediaQuery.of(parentContext).size.width,
            height: MediaQuery.of(parentContext).size.height,
            // Color must be defined otherwise the container can't be clicked on
            color: Colors.transparent,
          ),
        ),
        Positioned(
          width: 300,
          // Move this overlay to be where the parent is
          top: offsetLeft.dy + (renderBox.size.height / 2),
          left: offsetLeft.dx + (renderBox.size.width / 2),
          child: Card(
            child: SafeArea(
              minimum: const EdgeInsets.all(16),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  CommitAuthorAvatar(commit: commit),
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsetsDirectional.only(start: 16),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          Align(
                            alignment: Alignment.centerLeft,
                            child: AnimatedDefaultTextStyle(
                              style: theme.textTheme.subtitle1,
                              duration: kThemeChangeDuration,
                              child: Hyperlink(
                                text: commit.sha.substring(0, 7),
                                onPressed: _openGithub,
                              ),
                            ),
                          ),
                          const SizedBox(height: 8),
                          if (commit.message != null)
                            Padding(
                              padding: const EdgeInsets.only(bottom: 4),
                              child: AnimatedDefaultTextStyle(
                                style: theme.textTheme.bodyText2.copyWith(
                                  color: theme.textTheme.caption.color,
                                ),
                                duration: kThemeChangeDuration,
                                child: SelectableText(commit.message.split('\n').first),
                              ),
                            ),
                          SelectableText(commit.author),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ],
    );
  }