Git Product home page Git Product logo

Comments (4)

maxim-saplin avatar maxim-saplin commented on August 12, 2024

And yet in your code you have scrollable wrapping the widget and it is the very first thing I would point at...

Could you please provide a minimal reproduction sample based on any of the examples from /example folder?

from data_table_2.

gawie-kellerman avatar gawie-kellerman commented on August 12, 2024

Hi Maxim,

The ScrollView makes no difference. It is tough to give you a reproduction sample as it integrates with a custom websocket. Can I ask the question differently: have you tested the DataTable2 with a Stream? (especially one that that updates frequently (about 10 times a second))?

It is not necessary for me to use DataTable2, but I like and appreciate what you started doing with it, and thought I would likely contribute by pointing it out to you... since the same wrapper with DataTable 'native' works, there is obviously an issue in how I used DataTable2 here or a bug in it.

If it helps - below is a near complete stateful widget

class _MyHomePageState extends State<MyHomePage> {
 final _channel = WebSocketChannel.connect(
    Uri.parse('ws://localhost:8080/despatcher'),
  );

  @override
  void dispose() {
    _channel.sink.close();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            StreamBuilder(
              stream: _channel.stream,
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  final data = snapshot.data as Uint8List;
                  if (data.isNotEmpty) {
                    final list =
                        ObjectList.fromByteData(data.buffer.asByteData());

                    return DataTable2(
                      rows: List<DataRow>.generate(
                          list.nofObjects,
                          (index) => DataRow(cells: [
                                DataCell(Text(list.detail[index].x
                                    .toStringAsPrecision(2)))
                              ])),
                      columns: const [DataColumn2(label: Text('X'), size: ColumnSize.S)],
                    );
                  } else {
                    return const Text("No Data");
                  }
                }
                {
                  return const Text("No Data");
                }
              },
            )
          ],
        ),
      ),
    );
  }

from data_table_2.

gawie-kellerman avatar gawie-kellerman commented on August 12, 2024

Found the answer...

    child: Column(
      children: [
        Expanded(
          child: StreamBuilder(
            stream: _channel.stream,

Didn't need this with DataTable. Apologies and thanks.

from data_table_2.

maxim-saplin avatar maxim-saplin commented on August 12, 2024

Great that you solved it

from data_table_2.

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.