gjwgit / rattleng

The New Generation R Analytics Desktop App
GNU General Public License v3.0
20 stars 8 forks source link

DATASET: Add new panel to display the dataset and allow interactive editing #219

Open gjwgit opened 3 months ago

gjwgit commented 3 months ago

Is there a flutter dataset widget?

Would like to view the data in a spreadsheet kinf of way.

Allow editing and row and column deletion.

However, this then breaks the pattern of not having the dataset loaded into flutter as well as R!

The DataTable widget can be used to display a dataset in a spreadsheet-like form. The DataTable widget provides a flexible and powerful way to display tabular data.

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('DataTable Example'),
        ),
        body: MyDataTable(),
      ),
    );
  }
}

class MyDataTable extends StatelessWidget {
  final List<Map<String, dynamic>> data = [
    {"Name": "Alice", "Age": 25, "Email": "alice@example.com"},
    {"Name": "Bob", "Age": 30, "Email": "bob@example.com"},
    {"Name": "Charlie", "Age": 35, "Email": "charlie@example.com"},
  ];

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      child: DataTable(
        columns: [
          DataColumn(label: Text('Name')),
          DataColumn(label: Text('Age')),
          DataColumn(label: Text('Email')),
        ],
        rows: data.map((row) {
          return DataRow(
            cells: [
              DataCell(Text(row['Name'])),
              DataCell(Text(row['Age'].toString())),
              DataCell(Text(row['Email'])),
            ],
          );
        }).toList(),
      ),
    );
  }
}
gjwgit commented 2 months ago

Park this for now - I am not keen to duplicate the data into the app jsut for a minor functionality. The new VIEW dataset button is okay to view for now.