Share.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import 'package:flutter/material.dart';
  2. import '../widget/LinearButton.dart';
  3. class SharePage extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. return GestureDetector(
  7. onTap: () {
  8. Navigator.of(context).pop();
  9. },
  10. child: Scaffold(
  11. backgroundColor: Colors.transparent,
  12. floatingActionButtonLocation:
  13. FloatingActionButtonLocation.centerDocked,
  14. floatingActionButton: GestureDetector(
  15. onTap: () {},
  16. child: Container(
  17. height: 164,
  18. color: Color(0xFFF2F4F5),
  19. child: Column(
  20. children: <Widget>[
  21. Expanded(
  22. flex: 1,
  23. child: Row(
  24. mainAxisAlignment: MainAxisAlignment.center,
  25. crossAxisAlignment: CrossAxisAlignment.center,
  26. children: <Widget>[
  27. ShareButton(
  28. '微信', 'images/share_icon_weixin.png', () {
  29. }),
  30. ShareButton(
  31. '朋友圈', 'images/share_icon_pengyouquan.png', () {
  32. })
  33. ],
  34. ),
  35. ),
  36. LinearButton(
  37. btntext: '取消',
  38. colorList: [Colors.white, Colors.white],
  39. btnHeight: 44.0,
  40. textColor: Colors.black,
  41. onTapHomeMenu: () {
  42. Navigator.of(context).pop();
  43. },
  44. )
  45. ],
  46. ),
  47. ),
  48. ),
  49. ));
  50. }
  51. }
  52. typedef void OnTapButton();
  53. class ShareButton extends StatelessWidget {
  54. String title;
  55. String url;
  56. OnTapButton onTapButton;
  57. ShareButton(this.title, this.url, this.onTapButton);
  58. @override
  59. Widget build(BuildContext context) {
  60. return Padding(
  61. padding: EdgeInsets.only(left: 12, right: 12, top: 30),
  62. child: Column(
  63. children: <Widget>[Image.asset(url), Text(title)],
  64. ),
  65. );
  66. }
  67. }