Giter VIP home page Giter VIP logo

Comments (18)

Skyost avatar Skyost commented on July 4, 2024 1

Thanks for reporting, I'm gonna test it tomorrow.

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024 1

@rosostolato @iMajeed16 Done. I've published 0.3.0+1 on pub.dev, this issue should be fixed. I've even added a changeZoomFactor method on controllers. Feel free to try it out !

from flutterweekview.

iMajeed16 avatar iMajeed16 commented on July 4, 2024 1

@rosostolato @iMajeed16 Done. I've published 0.3.0+1 on pub.dev, this issue should be fixed. I've even added a changeZoomFactor method on controllers. Feel free to try it out !

everything seems perfect, thank you very much.

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

Can you please provide me your code ? And I would also like the plugin version you're using.

from flutterweekview.

iMajeed16 avatar iMajeed16 commented on July 4, 2024

@Skyost

I am using version flutter_week_view: 0.2.1+7
and this is my code:

DateTime now = DateTime.now();
DateTime date = DateTime(now.year, now.month, now.day);

@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: StreamBuilder(
            stream: Firestore.instance
                .collection('Task')
                .snapshots(),
            builder: (context, tasks) {
              if (tasks.hasData) {
                List<FlutterWeekViewEvent> events = [];
                for (int i = 0; i < tasks.data.documents.length; i++) {
                  DocumentSnapshot snap = tasks.data.documents[i];

                  events.add(
                    FlutterWeekViewEvent(
                      margin: EdgeInsets.all(0),
                      padding: EdgeInsets.all(0),
                      textStyle: thinWhite,
                      backgroundColor: getColor(
                        snap['state'],
                      ), // return a specific color by state number
                      title: 'Task ${snap['task_id']}',
                      description: 'Task ${snap['task_id']}',
                      start: DateTime.parse(
                        DateFormat('yyyy-MM-dd hh:mm').format(
                          snap['date_time_from'].toDate(),
                        ),
                      ),
                      end: DateTime.parse(
                        DateFormat('yyyy-MM-dd hh:mm').format(
                          snap['date_time_to'].toDate(),
                        ),
                      ),
                      onTap: () => Navigator.push(
                        context,
                        MaterialPageRoute(
                          builder: (context) => ProductsList(
                            documentSnapshot: snap,
                            state: 'details',
                          ),
                        ),
                      ),
                      onLongPress: () {
                        Toast.show('Task ${snap['task_id']}', context,
                            duration: Toast.LENGTH_LONG, gravity: Toast.BOTTOM);
                      },
                    ),
                  );
                }

                return WeekView(
                  hourRowHeight: 100.0,
                  hoursColumnTextStyle: thinWhiteRed,
                  dayBarTextStyle: titleDisable,
                  userZoomable: false,
                  dayViewWidth: MediaQuery.of(context).size.width / 2.5,
                  scrollToCurrentTime: true,
                  dates: [
                    date.subtract(
                      Duration(days: 3),
                    ),
                    date.subtract(
                      Duration(days: 2),
                    ),
                    date.subtract(
                      Duration(days: 1),
                    ),
                    date,
                    date.add(
                      Duration(days: 1),
                    ),
                    date.add(
                      Duration(days: 2),
                    ),
                    date.add(
                      Duration(days: 3),
                    )
                  ],
                  events: events,
                );
              } else {
                return Container();
              }
            }),
      ),
    );
  }

Edit: I've tried it in DayView and it works just fine changed the height and the blocks match the time whatever height I gave, the issue is only in WeekView.

Thank you.

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

Sadly, I can't reproduce this bug. How are you changing hourRowHeight ?

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

I'm using flutter_week_view: ^0.3.0 and I had the same behaviour. My WeekView is inside a StreamBuilder like that example.

Here is my code:

  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          leading: IconButton(
            icon: Icon(Icons.arrow_back),
            onPressed: () => Navigator.pop(context),
          ),
          title: Text('Meus Clientes'),
        ),
        body: StreamBuilder<List<Map<String, dynamic>>>(
          stream: _fetchDocs(),
          builder: (context, snapshot) {
            if (!snapshot.hasData) {
              return Center(child: CircularProgressIndicator());
            }

            return WeekView(
              minimumTime: HourMinute(hour: 7),
              maximumTime: HourMinute(hour: 23),
              dates: List.generate(
                  15, (index) => DateTime.now().add(Duration(days: index))),
              events: snapshot.data.map((doc) {
                Schedule schedule = doc["schedule"];
                Service service = doc["service"];
                var date = schedule.date;

                return FlutterWeekViewEvent(
                  title: schedule.customer.displayName,
                  description: service.description,
                  start: date,
                  end: date.add(Duration(minutes: service.duration)),
                );
              }).toList(),
              style: WeekViewStyle(
                hourRowHeight: 100.0,
                dateFormatter: (year, month, day) => '$day/$month/$year',
                dayViewWidth: MediaQuery.of(context).size.width * 0.6,
              ),
            );
          },
        ),
      ),
    );
  }

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

@rosostolato Please tell me how you are changing hourRowHeight. Because in the code of both of you I only see a fixed value.

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

I do not change. I set this before launching the app and the display stays like that. And, on the fly, if I remove the property and hot reload, it goes back to default and displays it correctly.

The hour column is changing but the events columns do not.

Is that something related to the zoom behavior? What do you think?

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

@rosostolato Well, OP seems to have a problem with changing hourRowHeight (see issue title). So you're telling me that this bug occurs while zooming-in and out ?

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

@Skyost no sir, forgive me... I was just wondering, I couldn't test so much to try to find out what is happening, I just wanted to collaborate saying that I had that issue too.

And I was saying that I don't need to change the property value on runtime, if the value is not the default one, it will have the same behavior from the screenshots.

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

@Skyost by the way, is there a way to start the view zoomed in? Because if there is, I wouldn't need to set RowHeight because it would already solve my problem.

You did a good job on it. Thank you!

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

@rosostolato

And I was saying that I don't need to change the property value on runtime, if the value is not the default one, it will have the same behavior from the screenshots.

No problem, any contribution is welcome !
So I think I understand now : if you set a value to a non default one (i.e. ≠ 300), then this bug occurs. I thought it occured while changing it dynamically.

Is there a way to start the view zoomed in ?

Sure, just pinch to zoom in or out (CTRL + drag on emulator).

You did a good job on it. Thank you!

😉👍

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

No problem, any contribution is welcome !
So I think I understand now : if you set a value to a non default one (i.e. ≠ 300), then this bug occurs. I thought it occured while changing it dynamically.

Yes, for me the bug happens no matter if you change it dynamically or starts with a fixed value.

Sure, just pinch to zoom in or out (CTRL + drag on emulator).

But is there a way to start it by default? With full zoom in?

from flutterweekview.

Skyost avatar Skyost commented on July 4, 2024

Yes, for me the bug happens no matter if you change it dynamically or starts with a fixed value.

Okay, thank you. I'm gonna test it this afternoon / evening and will post my feedback here.

But is there a way to start it by default? With full zoom in?

Oops, I have misread you question. Yes there is a way : just create a custom controller and pass it to your Day View / Week View. Then in your initState, wait a frame and call controller.zoomStart() and then controller.zoomUpdate(details) with your custom details. I will add a controller.changeZoomFactor(newFactor) method, but for now you have to do it this way.

from flutterweekview.

rosostolato avatar rosostolato commented on July 4, 2024

@Skyost cool! Thank you!

from flutterweekview.

iMajeed16 avatar iMajeed16 commented on July 4, 2024

@Skyost Sorry for being late, thank you @rosostolato for helping with this.

from flutterweekview.

iMajeed16 avatar iMajeed16 commented on July 4, 2024
const ZoomableHeaderWidgetStyle({
    DateFormatter dateFormatter,
    TimeFormatter timeFormatter,
    this.dayBarTextStyle,
    double dayBarHeight,
    this.dayBarBackgroundColor,
    this.hoursColumnTextStyle,
    double hoursColumnWidth,
    this.hoursColumnBackgroundColor,
    double hourRowHeight,
  })  : dateFormatter = dateFormatter ?? DefaultBuilders.defaultDateFormatter,
        timeFormatter = timeFormatter ?? DefaultBuilders.defaultTimeFormatter,
        dayBarHeight = (dayBarHeight ?? 40) < 0 ? 0 : (dayBarHeight ?? 40),
        hoursColumnWidth = (hoursColumnWidth ?? 60) < 0 ? 0 : (hoursColumnWidth ?? 60),
        hourRowHeight = (hourRowHeight ?? 60) < 0 ? 0 : (hourRowHeight ?? 60);
}

I did some testing

hourRowHeight = (hourRowHeight ?? 60) < 0 ? 0 : (hourRowHeight ?? 60);

In this, it takes the 60 no matter what value I gave it won't change after I download the plug-in and added it to my project and change the 60 to the value I gave in

return WeekView(
                  hourRowHeight: 100.0,
 )

it works.

The reason I am changing the height because as you can see the start and end times it is too little and because of that the height of the blocks is too small and it will not show the title nor the description.

flutter_01

Thanks.

from flutterweekview.

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.