import 'package:anyway/structs/trip.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';

class CurrentTripErrorMessage extends StatefulWidget {
  final Trip trip;
  const CurrentTripErrorMessage({
    super.key,
    required this.trip,
  });

  @override
  State<CurrentTripErrorMessage> createState() => _CurrentTripErrorMessageState();
}

class _CurrentTripErrorMessageState extends State<CurrentTripErrorMessage> {
  @override
  Widget build(BuildContext context) => Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Text(
          "😢",
          style: TextStyle(
            fontSize: 40,
          ),
        ),
        const SizedBox(height: 10),
        AutoSizeText(
          // at this point the trip is guaranteed to have an error message
          widget.trip.errorDescription!,
          maxLines: 30,
          style: Theme.of(context).textTheme.bodyMedium,
          textAlign: TextAlign.center,

        ),
      ],
    ),
  );

}