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: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        const Icon(
          Icons.error_outline,
          color: Colors.red,
          size: 50,
        ),
        const Padding(
          padding: EdgeInsets.only(left: 10),
        ),
        AutoSizeText(
          'Error: ${widget.trip.errorDescription}',
          maxLines: 3,
        ),
      ],
    )
  );
}
