sqlview 0.1.0 copy "sqlview: ^0.1.0" to clipboard
sqlview: ^0.1.0 copied to clipboard

outdated

Sql view widgets for Sqlcool. A ready to use page widget to handle Sqlite database crud operations

Sqlview #

pub package

Crud page widget for Sqlite and Flutter using Sqlcool

Example #

import 'package:flutter/material.dart';
import 'package:sqlcool/sqlcool.dart';
import 'package:sqlview/sqlview.dart';

class _PageExpensesState extends State<PageExpenses> {
final SelectBloc bloc = SelectBloc(
 table: "mytable",
 columns: "id,name",
 where: 'name LIKE "%joe%"',
 orderBy: 'name ASC',
 reactive: true,
 verbose: true,
);

@override
Widget build(BuildContext context) {
 return Stack(
   children: <Widget>[
     CrudView(
         bloc: bloc,
         onUpdate: update,
         onDelete: delete,
         trailingBuilder: (_context, _item) {
           return IconButton(
             icon: Icon(Icons.location_off),
             onPressed: () => print("$_item"),
           );
         }),
     Positioned(
         right: 15.0,
         bottom: 15.0,
         child: FloatingActionButton(
           heroTag: "actionBtn",
           child: Icon(Icons.add),
           onPressed: () => print("Add action"),
         )),
   ],
 );
}
}

update(BuildContext context, Map<String, dynamic> item) {
// item is the json record
showDialog(
   context: context,
   builder: (BuildContext context) {
     return AlertDialog(
       title: Text("Update"),
       // ...
       // Update using the Sqlcool database
       // Map<String, String> row = {"name": "value"};
       // db.update(table: "mytable", row: row, where: 'id=${item["id"]}');
     );
   });
}

delete(BuildContext context, Map<String, dynamic> item) {
// item is the json record
showDialog(
   context: context,
   builder: (BuildContext context) {
     return AlertDialog(
       title: Text("Delete"),
       // ...
       // delete using the Sqlcool database
       // db.delete(table: "mytable", where: 'id=${item["id"]}');
     );
   });
}

class PageExpenses extends StatefulWidget {
@override
_PageExpensesState createState() => _PageExpensesState();
}

1
likes
0
pub points
2%
popularity

Publisher

unverified uploader

Sql view widgets for Sqlcool. A ready to use page widget to handle Sqlite database crud operations

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter, flutter_slidable, sqlcool

More

Packages that depend on sqlview