all_cars.dart 810 B

1234567891011121314151617181920212223242526272829
  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. /// Description:
  6. /// Time : 09/04/2023 Monday
  7. /// Author : liuyuqi.gov@msn.cn
  8. class AllCarsTab extends StatelessWidget {
  9. const AllCarsTab({super.key});
  10. @override
  11. Widget build(BuildContext context) {
  12. return Consumer<CarProvider>(
  13. builder: (context, cars, _) => cars.allCars.isNotEmpty
  14. ? CarList(
  15. cars: cars.allCars,
  16. )
  17. : const Center(
  18. child: Text(
  19. 'There are no cars',
  20. style: TextStyle(
  21. fontSize: 25.0,
  22. ),
  23. ),
  24. ),
  25. );
  26. }
  27. }