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

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

Closed
realth000 opened this issue Oct 21, 2023 · 5 comments
Closed

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

realth000 opened this issue Oct 21, 2023 · 5 comments

Comments

@realth000
Copy link

现在的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里没有看到滚动条(应该不是颜色太淡了),目前没看出来是如何做到的。

  • OS: Linux
  • Flutter version: 3.13.7
  • easy_refresh version: 3.3.2+1
@realth000
Copy link
Author

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

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

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

@xuelongqy
Copy link
Owner

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

@realth000
Copy link
Author

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

都行的,感谢!

@xuelongqy
Copy link
Owner

3.3.3已修改

@realth000
Copy link
Author

感谢,已经好使了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants