基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

66 lines
2.0 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. class HomeAuth extends StatelessWidget {
  4. final Map<String, dynamic> data;
  5. const HomeAuth(this.data, {Key key}) : super(key: key);
  6. @override
  7. Widget build(BuildContext context) {
  8. return Container(
  9. height: 34,
  10. width: double.infinity,
  11. margin: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
  12. decoration: BoxDecoration(
  13. color: Colors.white,
  14. borderRadius: BorderRadius.circular(17),
  15. boxShadow: [
  16. BoxShadow(
  17. offset: Offset(2, 1), //x,y轴
  18. color: Color(0x4d767676), //投影颜色
  19. blurRadius: 5 //投影距离
  20. )
  21. ]),
  22. child: Row(
  23. children: <Widget>[
  24. Container(
  25. margin: EdgeInsets.only(left: 10, right: 8),
  26. width: 20,
  27. height: 20,
  28. color: Colors.redAccent,
  29. ),
  30. Expanded(
  31. child: Text(
  32. '一键授权淘宝权限,让购物更轻松',
  33. maxLines: 1,
  34. style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold),
  35. ),
  36. ),
  37. GestureDetector(
  38. child: Container(
  39. padding: EdgeInsets.only(left: 12, right: 12, top: 3, bottom: 3),
  40. margin: EdgeInsets.only(left: 8, right: 8),
  41. decoration: BoxDecoration(
  42. color: Colors.redAccent,
  43. borderRadius: BorderRadius.circular(20)),
  44. child: Text(
  45. '点击授权',
  46. style: TextStyle(fontSize: 12, color: Colors.white),
  47. ),
  48. ),
  49. onTap: () async {
  50. bool isAuth = await TaobaoAuth.isAuth();
  51. if (!isAuth) {
  52. TaobaoAuth.auth(context);
  53. } else {
  54. Logger.debug('您已经授权过了');
  55. }
  56. },
  57. ),
  58. ],
  59. ),
  60. );
  61. }
  62. }