Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLStaticListView 使用,当sections元素很多的时候不能支持页面滚动吗? #35

Open
jcleng opened this issue May 29, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@jcleng
Copy link

jcleng commented May 29, 2020

测试源码

import 'package:flui/flui.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

/// 用户中心页面
class UserSettingPage extends StatefulWidget {
  UserSettingPage({Key key}) : super(key: key);

  @override
  _UserSettingPageState createState() => _UserSettingPageState();
}

class _UserSettingPageState extends State<UserSettingPage> with RouteAware {
  // 点击底部退出按钮
  willSelectLogout() {
    showDialog(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return AlertDialog(
          content: SingleChildScrollView(
            child: ListBody(
              children: <Widget>[
                Padding(
                  padding: EdgeInsets.only(top: 40),
                ),
                GestureDetector(
                  onTap: () {},
                  child: Text('   退出登录'),
                ),
                Padding(
                  padding: EdgeInsets.only(bottom: 20),
                ),
                Padding(
                  padding: EdgeInsets.only(bottom: 20),
                ),
                GestureDetector(
                  onTap: () async {
                    await SystemChannels.platform
                        .invokeMethod('SystemNavigator.pop');
                  },
                  child: Text('   退出程序'),
                ),
              ],
            ),
          ),
          actions: <Widget>[
            FlatButton(
              child: Text('取消'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    ).then((val) {
      print(val);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: FLAppBarTitle(
          title: '设置',
          // subtitle: '(subtitle)',
        ),
        centerTitle: true,
      ),
      body: Container(
        child: ListView(
          children: [
            // 头像
            Container(
              child: Column(
                children: [
                  Padding(padding: EdgeInsets.only(top: 23)),
                  GestureDetector(
                    child: Container(
                        width: 80,
                        height: 80,
                        decoration: BoxDecoration(
                          shape: BoxShape.rectangle,
                          borderRadius: BorderRadius.circular(80),
                          image: DecorationImage(
                              image: NetworkImage(
                                  'https://www.dogedoge.com/rmt/QjmnZnf7-99_14oATuI2m-o6Gl5lNXUKPLEVtOSdermAm8fTGOx8mchN4?w=212&h=130'),
                              fit: BoxFit.cover),
                        )),
                    onTap: () {},
                  ),
                  Padding(padding: EdgeInsets.only(bottom: 20)),
                  GestureDetector(
                    onTap: () {},
                    child: Text(
                      '点击修改头像',
                      style: TextStyle(fontSize: 12, color: Color(0xFF999999)),
                    ),
                  )
                ],
              ),
            ),
            FLStaticListView(
              shrinkWrap: true,
              sections: [
                FLStaticSectionData(headerTitle: '账号', itemList: [
                  FLStaticItemData(
                      title: '账号管理',
                      accessoryType: FLStaticListCellAccessoryType.accDetail,
                      onTap: null),
                  FLStaticItemData(
                      title: '账号与安全',
                      accessoryType: FLStaticListCellAccessoryType.accDetail,
                      onTap: null),
                ]),
                FLStaticSectionData(headerTitle: '设置', itemList: [
                  FLStaticItemData(
                      title: '推送通知设置',
                      accessoryType: FLStaticListCellAccessoryType.accDetail,
                      accessoryString: '全部通知',
                      onTap: () => {}),
                  FLStaticItemData(
                    title: '护眼模式',
                    accessoryType: FLStaticListCellAccessoryType.accSwitch,
                    accItemValue: true,
                    onButtonPressed: () {
                      print('onButtonPressed');
                    },
                    onTap: () => {print('onTap')},
                  ),
                  FLStaticItemData(
                    title: '自动清理缓存',
                    subtitle: '每 10 天清理一次',
                    accessoryType: FLStaticListCellAccessoryType.accCheckmark,
                    onTap: null,
                    selected: false,
                  )
                ]),
                FLStaticSectionData(itemList: [
                  FLStaticItemData(
                      cellType: FLStaticListCellType.button,
                      buttonTitle: '退出登录',
                      buttonTitleColor: Colors.blue,
                      onButtonPressed: () {
                        print('button pressed');
                      }),
                  FLStaticItemData(
                      cellType: FLStaticListCellType.button,
                      buttonTitle: '退出程序',
                      buttonTitleColor: Colors.red,
                      onButtonPressed: () {
                        willSelectLogout();
                      })
                ])
              ],
            ),
          ],
        ),
      ),
    );
  }
}
@Rannie Rannie added the bug Something isn't working label Jun 4, 2020
@Rannie
Copy link
Owner

Rannie commented Jun 4, 2020

@jcleng ok 我会跟进下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants