item_country.dart 941 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:hengyi/data/country_entity.dart';
  4. import 'package:hengyi/detail/detail.dart';
  5. import 'package:hengyi/utils/common_util.dart';
  6. class CountryItemWidget extends StatelessWidget {
  7. const CountryItemWidget(this.country, {super.key});
  8. final CountryEntity country;
  9. @override
  10. Widget build(BuildContext context) {
  11. return GestureDetector(
  12. onTap: () {
  13. Util.gotoPage(context, DetailPageWidget(country.id));
  14. },
  15. child: Column(
  16. mainAxisAlignment: MainAxisAlignment.center,
  17. children: [
  18. Image(
  19. image: NetworkImage(country.countryImgUrl),
  20. width: 120.w,
  21. height: 120.w,
  22. ),
  23. Text(
  24. country.countryName,
  25. style: TextStyle(fontSize: 14, color: Colors.black),
  26. )
  27. ],
  28. ),
  29. );
  30. }
  31. }