ready_cars.dart 741 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_provider_demo/provider/car_provider.dart';
  3. import 'package:flutter_provider_demo/views/carlist.dart';
  4. import 'package:provider/provider.dart';
  5. class ReadyCarsTab extends StatelessWidget {
  6. const ReadyCarsTab({super.key});
  7. @override
  8. Widget build(BuildContext context) {
  9. return Consumer<CarProvider>(
  10. builder: (context, cars, _) => cars.startedCars.isNotEmpty
  11. ? CarList(
  12. cars: cars.startedCars,
  13. )
  14. : const Center(
  15. child: Text(
  16. 'There are no ready cars',
  17. style: TextStyle(
  18. fontSize: 25.0,
  19. ),
  20. ),
  21. ),
  22. );
  23. }
  24. }