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

Bug in 3.2.0 #19

Closed
ozzy1873 opened this issue Jul 22, 2022 · 5 comments · Fixed by #20
Closed

Bug in 3.2.0 #19

ozzy1873 opened this issue Jul 22, 2022 · 5 comments · Fixed by #20

Comments

@ozzy1873
Copy link

A bug was introduced in 3.2.0.

SplitView( viewMode: SplitViewMode.Vertical, controller: SplitViewController(weights: [0.35]), gripColorActive: AppColors.primaryAccent, indicator: const SplitIndicator(viewMode: SplitViewMode.Vertical), activeIndicator: const SplitIndicator( viewMode: SplitViewMode.Vertical, isActive: true, ), children: [ _buildMap(), PageView( physics: const NeverScrollableScrollPhysics(), onPageChanged: _onPageChanged, controller: pageController, children: [summary, gps, hr, cad, pwr], ), ]);

When the page is initially displayed, the SplitView works normally. However, once the PageView is switched to a different page, the SplitView gripColorActive no longer displays and the drag gesture becomes slow and jittery.

Switching back to version 3.1.0 fixes this problem.

@toshiaki-h
Copy link
Owner

@ozzy1873
Thank you for your report.
I had confirmed that the drag gesture slows down when switching to a different page.
However, I could not confirm that gripColorActive was not displayed.
I have retracted 3.2.0 because it is not good for drag gestures to be slow. Thank you.

@jpnurmi
Copy link
Contributor

jpnurmi commented Aug 7, 2022

@toshiaki-h was this caused by #18? Could you share a runnable example that reproduces the problem?

@toshiaki-h
Copy link
Owner

toshiaki-h commented Aug 11, 2022

Thanks @jpnurmi.

Here is sample code.

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, this.title}) : super(key: key);

  final String? title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title!),
      ),
      body: SplitView(
        children: [
          SplitView(
            viewMode: SplitViewMode.Horizontal,
            indicator: SplitIndicator(viewMode: SplitViewMode.Horizontal),
            activeIndicator: SplitIndicator(
              viewMode: SplitViewMode.Horizontal,
              isActive: true,
            ),
            gripColorActive: Colors.red,
            children: [
              Container(
                child: Center(child: Text("View1")),
                color: Colors.red,
              ),
              Container(
                child: Center(child: Text("View2")),
                color: Colors.blue,
              ),
              Container(
                child: Center(child: Text("View3")),
                color: Colors.green,
              ),
            ],
            onWeightChanged: (w) => print("Horizon: $w"),
          ),
          Container(
            child: Center(
              child: ElevatedButton(
                child: Text('View4'),
                onPressed: () {
                  Navigator.push(context, MaterialPageRoute(
                    builder: (context) {
                      return DummyPage();
                    },
                  ));
                },
              ),
            ),
            color: Colors.purple,
          ),
          Container(
            child: Center(child: Text("View5")),
            color: Colors.yellow,
          ),
        ],
        viewMode: SplitViewMode.Vertical,
        indicator: SplitIndicator(viewMode: SplitViewMode.Vertical),
        activeIndicator: SplitIndicator(
          viewMode: SplitViewMode.Vertical,
          isActive: true,
        ),
        controller: SplitViewController(limits: [null, WeightLimit(max: 0.5)]),
        onWeightChanged: (w) => print("Vertical $w"),
      ),
    );
  }
}

class DummyPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => DummyPageState();
}

class DummyPageState extends State<DummyPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Dummy')),
      body: Center(
        child: Text('dummy'),
      ),
    );
  }
}

@jpnurmi
Copy link
Contributor

jpnurmi commented Aug 11, 2022

Thanks, I was able to reproduce the issue after adding an extra setState() call to force a rebuild. I've pushed a fix proposal: #20

toshiaki-h added a commit that referenced this issue Aug 12, 2022
Added transition sample for issue #19.
@ozzy1873
Copy link
Author

I can confirm that the bug is fixed in 3.2.1. Thanks!

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

Successfully merging a pull request may close this issue.

3 participants