xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.93k stars 637 forks source link

内置的ScrollBar滚动条形状错误 #775

Closed realth000 closed 11 months ago

realth000 commented 1 year ago

现在的ScrollBar是个四四方方的矩形,似乎也没有办法调整。

如下代码:

import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: EasyRefresh(
        child: ListView(
          children: List.generate(
            100,
            (e) => Container(color: Colors.grey[800], child: Text('$e')),
          ),
        ),
      ),
    );
  }
}

出来的效果是这样:

screenshot_20231021082448573

换成sliver也不行:

return Scaffold(
  body: EasyRefresh(
    child: CustomScrollView(
      slivers: List.generate(
        100,
        (e) => SliverToBoxAdapter(
          child: Container(
            color: Colors.grey[800],
            child: Text('$e'),
          ),
        ),
      ),
    ),
  ),
);

screenshot_20231021082754659

是否可以默认改成material 3风格,或者提供一个自定义滚动条的选项,或者disable滚动条的选项?

示例app里没有看到滚动条(应该不是颜色太淡了),目前没看出来是如何做到的。

realth000 commented 1 year ago

设置EasyRefreshscrollBehaviorBuilder可以把滚动条去掉:

scrollBehaviorBuilder: (physics) {
  return ScrollConfiguration.of(context).copyWith(
    physics: physics,
    scrollbars: false,
  );
},

这算一个workaround吧,还是没找到内部的ScrollBar没有走material的原因。

xuelongqy commented 1 year ago

最新的代码,使用了Flutter默认的滚动条,但没有发布。你现在需要这个功能?

realth000 commented 1 year ago

最新的代码,使用了Flutter默认的滚动条,但没有发布。你现在需要这个功能?

都行的,感谢!

xuelongqy commented 11 months ago

3.3.3已修改

realth000 commented 11 months ago

感谢,已经好使了。