index.dart 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import 'package:flutter/material.dart';
  2. import 'package:fun_selfie_app/utils/common_toast.dart';
  3. import 'package:fun_selfie_app/widgets/home_button.dart';
  4. class PhotographyPage extends StatefulWidget {
  5. const PhotographyPage({Key? key}) : super(key: key);
  6. @override
  7. State<StatefulWidget> createState() => _PhotographyPageState();
  8. }
  9. class _PhotographyPageState extends State<PhotographyPage> {
  10. Widget renderImgBox(String imgSrc) {
  11. final screenSize = MediaQuery.of(context).size;
  12. return Container(
  13. padding: const EdgeInsets.only(left: 20),
  14. constraints: BoxConstraints(
  15. maxHeight: screenSize.height * 0.3, maxWidth: screenSize.width / 4),
  16. decoration: const BoxDecoration(
  17. boxShadow: [
  18. BoxShadow(
  19. color: Colors.black38,
  20. offset: Offset(0, 2),
  21. blurRadius: 5,
  22. spreadRadius: 3)
  23. ],
  24. ),
  25. child: Image(
  26. image: AssetImage(imgSrc),
  27. fit: BoxFit.fill,
  28. width: (screenSize.width - 100) / 4,
  29. ),
  30. );
  31. }
  32. @override
  33. Widget build(BuildContext context) {
  34. final screenSize = MediaQuery.of(context).size;
  35. return Scaffold(
  36. body: Container(
  37. width: screenSize.width,
  38. height: screenSize.height,
  39. decoration: const BoxDecoration(
  40. image: DecorationImage(
  41. fit: BoxFit.cover,
  42. image: AssetImage('static/images/photography_bg.png'))),
  43. child: Stack(children: <Widget>[
  44. Align(
  45. alignment: const Alignment(0, 0),
  46. child: SizedBox(
  47. width: 180,
  48. height: 60,
  49. child: ElevatedButton(
  50. child: const Text(
  51. '开始拍摄',
  52. style: TextStyle(fontSize: 20),
  53. ),
  54. onPressed: () {
  55. Navigator.pushNamed(context, "/takePhoto");
  56. },
  57. ))),
  58. const HomeButton(),
  59. Positioned(
  60. bottom: 0,
  61. left: 0,
  62. width: screenSize.width,
  63. // height: 200,
  64. child: Row(
  65. children: [
  66. renderImgBox('static/images/photo_img3.png'),
  67. renderImgBox('static/images/photo_img1.png'),
  68. renderImgBox('static/images/photo_img2.png'),
  69. renderImgBox('static/images/photo_img3.png'),
  70. ],
  71. ))
  72. ]),
  73. ));
  74. }
  75. }