main_common_view.dart 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:location/resource/colors.gen.dart';
  5. Widget buildMainFunctionView(ImageProvider icon, String name,
  6. {VoidCallback? onTap}) {
  7. return GestureDetector(
  8. onTap: onTap,
  9. child: Container(
  10. width: 42.w,
  11. height: 42.w,
  12. decoration: BoxDecoration(
  13. color: Colors.white,
  14. borderRadius: BorderRadius.circular(10.w),
  15. boxShadow: [
  16. BoxShadow(
  17. color: ColorName.black5.withOpacity(0.06),
  18. blurRadius: 10,
  19. spreadRadius: 6,
  20. offset: const Offset(0, 0),
  21. ),
  22. ],
  23. ),
  24. child: Column(
  25. mainAxisAlignment: MainAxisAlignment.center,
  26. children: [
  27. Image(image: icon, width: 24.w, height: 24.w),
  28. if (name.isNotEmpty)
  29. Text(name,
  30. style: TextStyle(
  31. fontSize: 9.sp,
  32. color: ColorName.black90,
  33. fontWeight: FontWeight.bold))
  34. ],
  35. ),
  36. ),
  37. );
  38. }