import 'package:flutter/material.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/core/extensions/build_context_extension.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/presentation/shared/layouts/app_default_scaffold.dart';

class CounterBase extends StatelessWidget {
  const CounterBase({
    required this.child,
    this.fabIncrement,
    this.fabIncrementBy10,
    this.fabDecrement,
    this.fabDecrementBy10,
    super.key,
  });

  final void Function()? fabIncrement;
  final void Function()? fabIncrementBy10;
  final void Function()? fabDecrement;
  final void Function()? fabDecrementBy10;

  final Widget child;

  @override
  Widget build(BuildContext context) => AppDefaultScaffold(
        title: Text(context.l10n.counterAppBarTitle),
        body: Center(
          child: child,
        ),
        fabChildren: [
          FloatingActionButton(
            heroTag: 'increment_tag',
            onPressed: fabIncrement,
            child: const Icon(Icons.add),
          ),
          const SizedBox(height: 8),
          FloatingActionButton(
            heroTag: 'increment_10_tag',
            onPressed: fabIncrementBy10,
            child: const Text('+10'),
          ),
          const SizedBox(height: 8),
          FloatingActionButton(
            heroTag: 'decrement_tag',
            onPressed: fabDecrement,
            child: const Icon(Icons.remove),
          ),
          const SizedBox(height: 8),
          FloatingActionButton(
            heroTag: 'decrement_10_tag',
            onPressed: fabDecrementBy10,
            child: const Text('-10'),
          ),
        ],
      );
}
