Giter Club home page Giter Club logo

Comments (6)

jja08111 avatar jja08111 commented on August 15, 2024 1

Hi @Hesham-Dev-LY, thank you for open the first issue!

Can you show me a reproducible example?

EDIT

I created the reproduced example. That occurs when switching the view mode state.

I'll try to fix the bug. Thanks.

import 'dart:math';

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

// Data must be sorted.
final smallDataList = [
  DateTimeRange(
    start: DateTime(2021, 2, 24, 23, 15),
    end: DateTime(2021, 2, 25, 7, 30),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 22, 1, 55),
    end: DateTime(2021, 2, 22, 9, 12),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 20, 0, 25),
    end: DateTime(2021, 2, 20, 7, 34),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 17, 21, 23),
    end: DateTime(2021, 2, 18, 4, 52),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 13, 6, 32),
    end: DateTime(2021, 2, 13, 13, 12),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 1, 9, 32),
    end: DateTime(2021, 2, 1, 15, 22),
  ),
  DateTimeRange(
    start: DateTime(2021, 1, 22, 12, 10),
    end: DateTime(2021, 1, 22, 16, 20),
  ),
];

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

class MyApp extends StatefulWidget {

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

class _MyAppState extends State<MyApp> {
  ViewMode _viewMode = ViewMode.weekly;

  @override
  Widget build(BuildContext context) {
    final sizedBox = const SizedBox(height: 16);
   // List<DateTimeRange> bigDataList = getRandomSampleDataList();

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Time chart example app')),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                const Text('Weekly time chart'),
                TimeChart(
                  data: smallDataList,
                  viewMode: _viewMode,
                ),
                Switch(value: _viewMode == ViewMode.weekly, onChanged: (_) {
                  setState(() {
                    _viewMode = _viewMode == ViewMode.weekly ? ViewMode.monthly : ViewMode.weekly;
                  });
                }),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

from time_chart.

Hesham-Dev-LY avatar Hesham-Dev-LY commented on August 15, 2024 1

from time_chart.

jja08111 avatar jja08111 commented on August 15, 2024 1

Well, the below code is working without any bugs. For now, I'll release the plugin that fixed the first issue. And please test again. Thank you.

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

// Data must be sorted.
final smallDataList = [
  DateTimeRange(
    start: DateTime(2021, 2, 24, 23, 15),
    end: DateTime(2021, 2, 25, 7, 30),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 22, 1, 55),
    end: DateTime(2021, 2, 22, 9, 12),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 20, 0, 25),
    end: DateTime(2021, 2, 20, 7, 34),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 17, 21, 23),
    end: DateTime(2021, 2, 18, 4, 52),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 13, 6, 32),
    end: DateTime(2021, 2, 13, 13, 12),
  ),
  DateTimeRange(
    start: DateTime(2021, 2, 1, 9, 32),
    end: DateTime(2021, 2, 1, 15, 22),
  ),
  DateTimeRange(
    start: DateTime(2021, 1, 22, 12, 10),
    end: DateTime(2021, 1, 22, 16, 20),
  ),
];

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Time chart example app')),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                const Text('Weekly time chart'),
                TimeChart(
                  data: smallDataList,
                  timeChartSizeAnimationDuration: Duration(milliseconds: 200),
                  chartType: ChartType.time,
                  viewMode: ViewMode.weekly,
                ),
                TimeChart(
                  data: smallDataList,
                  timeChartSizeAnimationDuration: Duration(milliseconds: 200),
                  chartType: ChartType.time,
                  viewMode: ViewMode.monthly,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

from time_chart.

jja08111 avatar jja08111 commented on August 15, 2024 1

I've released version 0.2.7.

from time_chart.

jja08111 avatar jja08111 commented on August 15, 2024

Hi @Hesham-Dev-LY,
I fixed the first issue, but I don't know the second issue is fixed because I can't reproduce it.
Can you show the example code?

from time_chart.

Hesham-Dev-LY avatar Hesham-Dev-LY commented on August 15, 2024

I didn't do anything big, I just put them in one column

TimeChart(
    data: data,
    timeChartSizeAnimationDuration: Duration(milliseconds: 200),
    chartType: ChartType.time,
    barColor: mainBlue,
    viewMode: ViewMode.weekly,
),
TimeChart(
    data: data,
    timeChartSizeAnimationDuration: Duration(milliseconds: 200),
    chartType: ChartType.time,
    barColor: mainBlue,
    viewMode: ViewMode.monthly,
)

from time_chart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.