<commit_before>import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:io_photobooth/external_links/external_links.dart';
import 'package:io_photobooth/l10n/l10n.dart';
import 'package:io_photobooth/photobooth/photobooth.dart';
import 'package:io_photobooth/share/share.dart';
import 'package:photobooth_ui/photobooth_ui.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class ShareBody extends StatelessWidget {
  const ShareBody({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final image = context.select((PhotoboothBloc bloc) => bloc.state.image);
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        AnimatedPhotoIndicator(),
        AnimatedPhotoboothPhoto(image: image),
        const SizedBox(height: 40),
        const Heading(),
        const SizedBox(height: 20),
        const LearnMoreAboutText(),
        const SizedBox(height: 30),
        if (image != null)
          ResponsiveLayoutBuilder(
            small: (_, __) => MobileButtonsLayout(image: image),
            large: (_, __) => DesktopButtonsLayout(
              image: image,
            ),
          ),
      ],
    );
  }
}

@visibleForTesting
class Heading extends StatelessWidget {
  const Heading({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final l10n = context.l10n;
    return Text(
      l10n.sharePageHeading,
      style: theme.textTheme.headline1?.copyWith(
        color: PhotoboothColors.white,
        fontSize:
            MediaQuery.of(context).size.width > PhotoboothBreakpoints.small
                ? 56
                : 32,
      ),
      textAlign: TextAlign.center,
    );
  }
}

@visibleForTesting
class DesktopButtonsLayout extends StatelessWidget {
  const DesktopButtonsLayout({Key? key, required this.image}) : super(key: key);

  final CameraImage image;

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        const Flexible(child: DownloadButton()),
        const SizedBox(width: 36),<commit_msg>fix: make share heading text selectable (#456)<commit_after>import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:io_photobooth/external_links/external_links.dart';
import 'package:io_photobooth/l10n/l10n.dart';
import 'package:io_photobooth/photobooth/photobooth.dart';
import 'package:io_photobooth/share/share.dart';
import 'package:photobooth_ui/photobooth_ui.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class ShareBody extends StatelessWidget {
  const ShareBody({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final image = context.select((PhotoboothBloc bloc) => bloc.state.image);
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        AnimatedPhotoIndicator(),
        AnimatedPhotoboothPhoto(image: image),
        const SizedBox(height: 40),
        const Heading(),
        const SizedBox(height: 20),
        const LearnMoreAboutText(),
        const SizedBox(height: 30),
        if (image != null)
          ResponsiveLayoutBuilder(
            small: (_, __) => MobileButtonsLayout(image: image),
            large: (_, __) => DesktopButtonsLayout(
              image: image,
            ),
          ),
      ],
    );
  }
}

@visibleForTesting
class Heading extends StatelessWidget {
  const Heading({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final l10n = context.l10n;
    return SelectableText(
      l10n.sharePageHeading,
      style: theme.textTheme.headline1?.copyWith(
        color: PhotoboothColors.white,
        fontSize:
            MediaQuery.of(context).size.width > PhotoboothBreakpoints.small
                ? 56
                : 32,
      ),
      textAlign: TextAlign.center,
    );
  }
}

@visibleForTesting
class DesktopButtonsLayout extends StatelessWidget {
  const DesktopButtonsLayout({Key? key, required this.image}) : super(key: key);

  final CameraImage image;

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        const Flexible(child: DownloadButton()),
        const SizedBox(width: 36),
{'fraction_non_alphanumeric': 0.10822998872604284, 'fraction_numerical': 0.01104847801578354, 'mean_word_length': 3.103607770582794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3725468', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1333, 'n_words': 267}