diff --git a/assets/icons/icon.png b/assets/icons/icon.png new file mode 100644 index 0000000..164a63d Binary files /dev/null and b/assets/icons/icon.png differ diff --git a/assets/icons/logotipo.png b/assets/icons/logotipo.png new file mode 100644 index 0000000..a682c7a Binary files /dev/null and b/assets/icons/logotipo.png differ diff --git a/assets/images/appbar.png b/assets/images/appbar.png new file mode 100644 index 0000000..dcb38ec Binary files /dev/null and b/assets/images/appbar.png differ diff --git a/assets/images/boleto.png b/assets/images/boleto.png new file mode 100644 index 0000000..ac5b3eb Binary files /dev/null and b/assets/images/boleto.png differ diff --git a/assets/images/contrato.png b/assets/images/contrato.png new file mode 100644 index 0000000..8da7bee Binary files /dev/null and b/assets/images/contrato.png differ diff --git a/assets/images/extrato-bancario.png b/assets/images/extrato-bancario.png new file mode 100644 index 0000000..8fd72ee Binary files /dev/null and b/assets/images/extrato-bancario.png differ diff --git a/assets/images/fatura.png b/assets/images/fatura.png new file mode 100644 index 0000000..bb4e90d Binary files /dev/null and b/assets/images/fatura.png differ diff --git a/assets/images/notaFiscal.png b/assets/images/notaFiscal.png new file mode 100644 index 0000000..a7edf55 Binary files /dev/null and b/assets/images/notaFiscal.png differ diff --git a/assets/images/pessoal.png b/assets/images/pessoal.png new file mode 100644 index 0000000..284418c Binary files /dev/null and b/assets/images/pessoal.png differ diff --git a/assets/images/recibo.png b/assets/images/recibo.png new file mode 100644 index 0000000..86b0c5d Binary files /dev/null and b/assets/images/recibo.png differ diff --git a/lib/components/categoriaList.dart b/lib/components/categoriaList.dart deleted file mode 100644 index 7533cf8..0000000 --- a/lib/components/categoriaList.dart +++ /dev/null @@ -1,149 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; - -import '../models/documento.dart'; - -class CategoriaList extends StatelessWidget { - final List documentos; - - //constructor - - CategoriaList(this.documentos); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: 520, - child: ListView.builder( - itemCount: documentos.length, - itemBuilder: (ctx, index) { - final doc = documentos[index]; - return Card( - color: const Color(0xffDEF1EB), - shadowColor: const Color(0xffFE7C3F), - margin: const EdgeInsets.all(5), - child: Row( - children: [ - GestureDetector( - onTap: () { - print('Teste'); - }, - child: Container( - margin: const EdgeInsets.only(left: 10), - child: Image.asset( - 'assets/images/icon_doc.png', - height: 55, - ), - ), - ), - Container( - width: 220, - padding: const EdgeInsets.all(5), - margin: const EdgeInsets.only(left: 10, top: 10, bottom: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - const Text( - 'Nome: ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: Colors.black), - ), - Text( - doc.id.toString(), - style: const TextStyle( - fontSize: 14, - color: Colors.black, - ), - ), - ], - ), - Row( - children: [ - const Text( - 'Competência: ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: Colors.black), - ), - Text( - DateFormat('d/MMM/y.') - .format(doc.criadoEm!) - .toString(), - style: const TextStyle( - fontSize: 14, color: Colors.black), - ), - ], - ), - Row( - children: [ - const Text( - 'Criado em: ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: Colors.black), - ), - Text( - DateFormat('d/MMM/y.') - .format(doc.criadoEm!) - .toString(), - style: const TextStyle( - fontSize: 14, color: Colors.black), - ), - ], - ), - Row( - children: [ - const Text( - 'Categoria: ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: Colors.black), - ), - Text( - doc.nome!, - style: const TextStyle( - fontSize: 14, - color: Colors.black, - ), - ), - ], - ), - ], - ), - ), - Container( - margin: const EdgeInsets.only(left: 5), - child: Row( - // ignore: prefer_const_literals_to_create_immutables - children: [ - const Icon( - Icons.edit, - color: Colors.amber, - size: 30.0, - ), - const SizedBox( - width: 15, - ), - const Icon( - Icons.delete, - color: Colors.red, - size: 30.0, - ), - ], - ), - ), - ], //children end - ), - ); - }, - ), - ); - } -} diff --git a/lib/components/modal_edit_del_document.dart b/lib/components/modal_edit_del_document.dart deleted file mode 100644 index a29f2b4..0000000 --- a/lib/components/modal_edit_del_document.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class ModalDocumentoExcluirEditar extends StatelessWidget { - - - @override - Widget build(BuildContext context) { - return Container(); - } -} diff --git a/lib/database/database_config.dart b/lib/database/database_config.dart new file mode 100644 index 0000000..04145e0 --- /dev/null +++ b/lib/database/database_config.dart @@ -0,0 +1,159 @@ +import 'dart:io'; +import 'package:path/path.dart'; +import 'package:sqflite/sqflite.dart'; +import 'package:to_file/models/categoria.dart'; +import 'package:path_provider/path_provider.dart'; + +import '../models/documento.dart'; +import '../models/notificacao.dart'; + +class DatabaseHelper { + DatabaseHelper._privateConstructor(); + static final DatabaseHelper instance = DatabaseHelper._privateConstructor(); + + static Database? _database; + Future get database async => _database ??= await _initDatabase(); + + Future _initDatabase() async { + Directory documentsDirectory = await getApplicationDocumentsDirectory(); + print(documentsDirectory.path); + String path = documentsDirectory.path + '/' + 'twofile.db'; + + return await openDatabase(path, version: 2, onCreate: _onCreate); + } + + Future _onCreate(Database db, int version) async { + await db.execute(documentos); + await db.execute(notificacoes); + await db.execute(categorias); + } + + String documentos = ''' + CREATE TABLE documentos( + id INTEGER PRIMARY KEY AUTOINCREMENT, + nome VARCHAR(255) NOT NULL, + dataCompetencia DATE NULL, + dataValidade DATE NULL, + criadoEm DATE NULL, + categoria_id INT NOT NULL, + FOREIGN KEY (categoria_id) REFERENCES categorias (id) + )'''; + + String notificacoes = ''' + CREATE TABLE notificacoes( + id INTEGER PRIMARY KEY AUTOINCREMENT + )'''; + + String categorias = ''' + CREATE TABLE categorias( + id INTEGER PRIMARY KEY AUTOINCREMENT, + nome TEXT + )'''; + + //Return Lista de documentos por id categoria + Future> listDocumentosByCategoriaId(int id) async { + Database db = await instance.database; + var documentos = await db.query('documentos', + orderBy: 'nome', where: 'categoria_id = ?', whereArgs: [id]); + List documentosList = documentos.isNotEmpty + ? documentos.map((document) => Documento.fromMap(document)).toList() + : []; + return documentosList; + } + + //Return Lista de documentos + Future> listDocumentos() async { + Database db = await instance.database; + var documentos = await db.query('documentos', orderBy: 'nome'); + List documentosList = documentos.isNotEmpty + ? documentos.map((e) => Documento.fromMap(e)).toList() + : []; + return documentosList; + } + + //adicionar Documento + Future addDocumento(Documento documento) async { + Database db = await instance.database; + return await db.insert('documentos', documento.toMap()); + } + + //remover documento + Future removeDocumento(int id) async { + Database db = await instance.database; + return await db.delete('documentos', where: 'id = ?', whereArgs: [id]); + } + + //editar documento + Future updateDocumento(Documento documento) async { + Database db = await instance.database; + return await db.update('documentos', documento.toMap(), + where: 'id = ?', whereArgs: [documento.id]); + } + + // Retorna todas as categorias + Future> todasCategorias() async { + Database db = await instance.database; + List> allRows = await db.query('categorias'); + List categorias = + allRows.map((categoria) => Categoria.fromMap(categoria)).toList(); + return categorias; + } + + //Return Lista de dcategorias + Future> listCategoriaById() async { + Database db = await instance.database; + var categorias = await db.query('categorias', orderBy: 'id'); + List categoriaList = categorias.isNotEmpty + ? categorias.map((e) => Categoria.fromMap(e)).toList() + : []; + return categoriaList; + } + + //adicionar Categoria + Future addCategoria(Categoria categoria) async { + Database db = await instance.database; + return await db.insert('categorias', categoria.toMap()); + } + + //remover categoria + Future removeCategoria(int id) async { + Database db = await instance.database; + return await db.delete('categorias', where: 'id = ?', whereArgs: [id]); + } + + //editar categoria + Future updateCategoria(Categoria categoria) async { + Database db = await instance.database; + return await db.update('categorias', categoria.toMap(), + where: 'id = ?', whereArgs: [categoria.id]); + } + + //Return Lista de dcategorias + Future> listNotificacoes() async { + Database db = await instance.database; + var notificacoes = await db.query('notificacoes', orderBy: 'id'); + List notificacoesList = notificacoes.isNotEmpty + ? notificacoes.map((e) => Notificacao.fromMap(e)).toList() + : []; + return notificacoesList; + } + + //adicionar Notificacao + Future addNotificacao(Notificacao notificacao) async { + Database db = await instance.database; + return await db.insert('categorias', notificacao.toMap()); + } + + //remover notificacao + Future removeNotificacao(int id) async { + Database db = await instance.database; + return await db.delete('notificacoes', where: 'id = ?', whereArgs: [id]); + } + + //editar categoria + Future updateNotificacao(Notificacao notificacao) async { + Database db = await instance.database; + return await db.update('notificacoes', notificacao.toMap(), + where: 'id = ?', whereArgs: [notificacao.id]); + } +} diff --git a/lib/main.dart b/lib/main.dart index 23f483b..a240b03 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,27 +1,27 @@ -import 'package:first_app/pages/listview_categoria_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:to_file/pages/homePage.dart'; -main() => runApp(TwoFileApp()); - -class TwoFileApp extends StatefulWidget { - @override - State createState() => _TwoFileAppState(); +void main() { + WidgetsFlutterBinding.ensureInitialized(); + runApp(const TwoFileApp()); } -class _TwoFileAppState extends State { +class TwoFileApp extends StatelessWidget { + const TwoFileApp({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { - final ThemeData tema = ThemeData(); - - return MaterialApp( - debugShowCheckedModeBanner: false, - home: CategoriaListPage(), - theme: tema.copyWith( - colorScheme: tema.colorScheme.copyWith( - primary: const Color(0xff0C322C), - secondary: Colors.amber, - ), - ), - ); + return const MaterialApp( + localizationsDelegates: [ + GlobalWidgetsLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + ], + supportedLocales: [ + Locale("pt", "BR") + ], + debugShowCheckedModeBanner: false, + home: HomePage() // tela inicial do App + ); } } diff --git a/lib/models/categoria.dart b/lib/models/categoria.dart index 9f9d174..8f2d118 100644 --- a/lib/models/categoria.dart +++ b/lib/models/categoria.dart @@ -1,9 +1,25 @@ -class Categoria{ +class Categoria { + int? id; + String nome; + // String? nome_icone; + // DateTime criadoEm; - int? id; - String? nome; - String? nome_icone; - DateTime? timestamp; + Categoria({ + this.id, + required this.nome, + }); - Categoria({this.nome, this.nome_icone, this.timestamp}); + factory Categoria.fromMap(Map json) => Categoria( + id: json['id'], + nome: json['name'], + // criadoEm: json['criado_em'], + //inserir o campo nomeIcone + ); + + Map toMap() => { + 'id': id, + 'name': nome, + // 'criado_em': criadoEm, + //inserir o campo nomeIcone + }; } diff --git a/lib/models/documento.dart b/lib/models/documento.dart index 32cf1a9..eaefedb 100644 --- a/lib/models/documento.dart +++ b/lib/models/documento.dart @@ -1,13 +1,38 @@ import 'categoria.dart'; -class Documento{ - +class Documento { int? id; String? nome; + DateTime? dataCompetencia; + DateTime? dataValidade; DateTime? criadoEm; + int? categoria_id; + Documento( + {this.id, + this.nome, + this.dataCompetencia, + this.dataValidade, + this.criadoEm, + this.categoria_id}); - Documento({this.id, this.nome, this.criadoEm}); - + factory Documento.fromMap(Map json) => Documento( + id: json['id'], + nome: json['nome'], + dataCompetencia: json['dataCompetencia'], + dataValidade: json['dataValidade'], + criadoEm: json['criadoEm'], + categoria_id: json['categoria_id'], + ); -} \ No newline at end of file + Map toMap() { + return { + 'id': id, + 'nome': nome, + 'dataCompetencia': dataCompetencia?.microsecondsSinceEpoch, + 'dataValidade': dataValidade?.microsecondsSinceEpoch, + 'criadoEm': criadoEm?.microsecondsSinceEpoch, + 'categoria_id': categoria_id, + }; + } +} diff --git a/lib/models/notificacao.dart b/lib/models/notificacao.dart new file mode 100644 index 0000000..6c29502 --- /dev/null +++ b/lib/models/notificacao.dart @@ -0,0 +1,18 @@ +class Notificacao { + int? id; + DateTime criadoEm; + + Notificacao({this.id, required this.criadoEm}); + + factory Notificacao.fromMap(Map json) => Notificacao( + id: json['id'], + criadoEm: json['criado_em'], + //inserir o campo id_documento + ); + + Map toMap() => { + 'id': id, + 'criado_em': criadoEm, + //inserir o campo id_documento + }; +} diff --git a/lib/pages/cadastrar_documentoPage.dart b/lib/pages/cadastrar_documentoPage.dart new file mode 100644 index 0000000..7eb254d --- /dev/null +++ b/lib/pages/cadastrar_documentoPage.dart @@ -0,0 +1,124 @@ +// ignore_for_file: avoid_print + +import 'package:flutter/material.dart'; + +import 'package:intl/intl.dart'; + +import '../database/database_config.dart'; +import '../models/documento.dart'; +import 'categoria_page.dart'; + +class CadastrarDocumentoPage extends StatefulWidget { + const CadastrarDocumentoPage({Key? key}) : super(key: key); + + @override + State createState() => _CadastrarDocumentoPageState(); +} + +class _CadastrarDocumentoPageState extends State { + final textController = TextEditingController(); + + final _controllerNome = TextEditingController(); + final _controllerDataCompetencia = TextEditingController(); + final _controllerDataValidade = TextEditingController(); + + DateTime? pickedDataCompetencia; + DateTime? pickedDataValidade; + DateTime? dataCompetenciaTimeStamp; + DateTime? dataValidadeTimeStamp; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color.fromARGB(255, 255, 255, 255), + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: const Text('Adicionar documento'), + ), + body: ListView(padding: const EdgeInsets.all(16), children: [ + TextField( + controller: _controllerNome, + decoration: const InputDecoration( + border: OutlineInputBorder(), labelText: 'Nome do Documento'), + ), + const SizedBox(height: 24), + TextField( + controller: _controllerDataCompetencia, + decoration: const InputDecoration( + icon: Icon(Icons.calendar_today), + labelText: "Data de Competência"), + readOnly: true, + onTap: () { + _pickDateDialogCompetencia(); + }), + TextField( + controller: _controllerDataValidade, + decoration: const InputDecoration( + icon: Icon(Icons.calendar_today), + labelText: "Data de Validade"), + readOnly: true, + onTap: () { + _pickDateDialogValidade(); + }), + const SizedBox(height: 32), + ElevatedButton( + child: const Text('Salvar'), + onPressed: () { + final documento = Documento( + nome: _controllerNome.text, + dataCompetencia: pickedDataCompetencia!, + dataValidade: pickedDataValidade!, + criadoEm: DateTime.now(), + categoria_id: + ); + + DatabaseHelper.instance.addDocumento(documento); + + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const CategoriaPage())); + }, + ) + ]), + ); + } + + void _pickDateDialogCompetencia() async { + pickedDataCompetencia = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2000), + lastDate: DateTime(2023), + locale: const Locale("pt", "BR"), + ); + + if (pickedDataCompetencia != null) { + setState(() { + _controllerDataCompetencia.text = + '${pickedDataCompetencia!.day}/${pickedDataCompetencia!.month}/${pickedDataCompetencia!.year}'; + dataCompetenciaTimeStamp = DateTime.fromMicrosecondsSinceEpoch( + pickedDataCompetencia!.microsecondsSinceEpoch); + }); + } + } + + void _pickDateDialogValidade() async { + pickedDataValidade = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2000), + lastDate: DateTime(2023), + locale: const Locale("pt", "BR"), + ); + + if (pickedDataValidade != null) { + setState(() { + _controllerDataValidade.text = + '${pickedDataValidade!.day}/${pickedDataValidade!.month}/${pickedDataValidade!.year}'; + dataValidadeTimeStamp = DateTime.fromMicrosecondsSinceEpoch( + pickedDataValidade!.microsecondsSinceEpoch); + }); + } + } +} diff --git a/lib/pages/categoria_page.dart b/lib/pages/categoria_page.dart new file mode 100644 index 0000000..c63c56b --- /dev/null +++ b/lib/pages/categoria_page.dart @@ -0,0 +1,165 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../database/database_config.dart'; +import '../models/categoria.dart'; +import '../models/documento.dart'; + +class CategoriaPage extends StatefulWidget { + const CategoriaPage({super.key, required this.categoria}); + + final Categoria categoria; + + @override + State createState() => _CategoriaPageState(); +} + +class _CategoriaPageState extends State { + int? seletctedId; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: Text( + '${DatabaseHelper.instance.listDocumentosByCategoriaId(widget.categoria.id!)}'), + ), + body: Center( + child: FutureBuilder>( + future: DatabaseHelper.instance + .listDocumentosByCategoriaId(widget.categoria.id!), + builder: ( + BuildContext context, + AsyncSnapshot> snapshot, + ) { + return snapshot.data!.isEmpty + ? const Center( + child: Text('Lista de documentos vazia.'), + ) + : ListView( + children: snapshot.data!.map((document) { + return Center( + child: Card( + color: const Color(0xffDEF1EB), + child: Column( + children: [ + ListTile( + contentPadding: + const EdgeInsets.fromLTRB(10, 10, 10, 5), + leading: Image.asset( + 'assets/images/icon_doc.png', + height: 60), + title: Text( + document.nome!, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24), + ), + subtitle: Padding( + padding: const EdgeInsets.all(8.0), + child: RichText( + text: TextSpan(children: [ + const TextSpan( + text: 'Competência: ', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + TextSpan( + text: ' ${document.dataCompetencia}.', + style: const TextStyle( + color: Colors.black), + ), + const TextSpan( + text: '\nValidade: ', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black)), + TextSpan( + text: ' ${document.dataValidade}.', + style: const TextStyle( + color: Colors.black), + ), + const TextSpan( + text: '\nCriado em: ', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black)), + TextSpan( + text: ' ${document.criadoEm}.', + style: const TextStyle( + color: Colors.black), + ), + ]), + ), + ), + trailing: PopupMenuButton( + itemBuilder: (BuildContext context) => [ + const PopupMenuItem<_ValueDialog>( + value: _ValueDialog.editar, + child: Text("Editar"), + ), + const PopupMenuItem( + value: _ValueDialog.excluir, + child: Text('Excluir'), + ), + ], + onSelected: (value) { + switch (value) { + case _ValueDialog.editar: + //chamar cadastrarDocumento passando o documento + break; + case _ValueDialog.excluir: + showDialog( + context: context, + builder: (context) => AlertDialog( + elevation: 5.0, + title: Text( + "Deseja excluir ${document.nome} definitivamente?"), + actions: [ + MaterialButton( + child: const Text("Sim"), + onPressed: () { + setState(() { + DatabaseHelper.instance + .removeDocumento( + document.id!); + }); + + Navigator.pop(context); + }, + ), + MaterialButton( + child: const Text('Não'), + onPressed: () {}, + ) + ], + ), + ); + break; + } + }, + ), + isThreeLine: false, + onTap: () { + //chamar função para abrir view documento + }, + ), + ], + ), + ), + ); + }).toList(), + ); + }, + ), + ), + ); + } +} + +enum _ValueDialog { + editar, + excluir, +} diff --git a/lib/pages/homePage.dart b/lib/pages/homePage.dart new file mode 100644 index 0000000..3d61244 --- /dev/null +++ b/lib/pages/homePage.dart @@ -0,0 +1,448 @@ +import 'package:flutter/material.dart'; + +import 'package:to_file/pages/cadastrar_documentoPage.dart'; +import 'package:to_file/pages/newCategoriaPage.dart'; +import 'package:to_file/pages/pesquisaPage.dart'; +import 'package:to_file/pages/sobrePage.dart'; + +import 'categoria_page.dart'; + +class HomePage extends StatefulWidget { + const HomePage({Key? key}) : super(key: key); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + TextEditingController? textController; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xffF5F5F5), + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: Image.asset( + 'assets/images/appbar.png', + height: 100.0, + width: 120.0, + fit: BoxFit.cover, + ), + actions: [ + IconButton( + onPressed: () { + setState(() { + pageSobre(); + }); + }, + icon: const Icon(Icons.info, color: Color(0xffFE7C3F)), + ), + const IconButton( + onPressed: null, + icon: Icon( + Icons.notifications, + color: Color(0xffFE7C3F), + )) + ], + ), + body: Column( + children: [ + Container( + margin: const EdgeInsets.only(top: 30.0), + height: 65, + width: 350, + // alignment: Alignment.center, + padding: const EdgeInsets.all(10), + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.white), + ), + onPressed: () { + setState(() { + pageSearch(); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: const [ + Text( + 'pesquisar', + style: TextStyle( + color: Color(0xffB9B1B1), + ), + ), + Icon( + Icons.search, + color: Color(0xffB9B1B1), + ), + ], + ), + ), + ), + const SizedBox(height: 20), + Container( + height: 400.0, + child: GridView.count( + crossAxisCount: 3, + primary: false, + padding: const EdgeInsets.all(20), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + children: [ + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + const CadastrarDocumentoPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 5.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/recibo.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Recibo"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => CategoriaPage(), + )); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + icon: ImageIcon( + AssetImage('assets/images/fatura.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + onPressed: null, + ), + Text("Fatura"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/extrato-bancario.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Extrato Bancário", textAlign: TextAlign.center), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/notaFiscal.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Nota Fiscal"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/contrato.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Contrato"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/boleto.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Boleto"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + CategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + IconButton( + onPressed: null, + icon: ImageIcon( + AssetImage('assets/images/pessoal.png'), + color: Color(0xffFE7C3F), + size: 40, + ), + ), + Text("Pessoal"), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + const NewCategoriaPage())); + }, + child: Container( + height: 100.0, + width: 100.0, + padding: const EdgeInsets.all(8), + // color: const Color(0xffEAEBD9), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.0), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + blurRadius: 3.0, + offset: Offset(0.0, 0.80), + ), + ], + ), + child: const IconButton( + onPressed: null, + icon: Icon( + Icons.add, + color: Color(0xffFE7C3F), + size: 40, + )), + ), + ), + ], + ), + ), + ], + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + setState(() { + pageDocument(); + }); + }, + backgroundColor: const Color(0xff30BA78), + child: const Icon( + Icons.add, + color: Colors.white, + size: 40, + ), + ), + ); + } + + void pageSobre() { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const SobrePage())); + } + + void pageDocument() { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const CadastrarDocumentoPage())); + } + + void pageSearch() { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const PesquisaPage())); + } +} diff --git a/lib/pages/listview_categoria_page.dart b/lib/pages/listview_categoria_page.dart deleted file mode 100644 index 59c83ca..0000000 --- a/lib/pages/listview_categoria_page.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:first_app/models/categoria.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import '../components/categoriaList.dart'; -import '../models/documento.dart'; - -class CategoriaListPage extends StatefulWidget { - @override - State createState() => _CategoriaListPageState(); -} - -class _CategoriaListPageState extends State { - late final List _documentosList = [ - Documento( - id: 1, - nome: 'Carta', - criadoEm: DateTime.now(), - ), - Documento(id: 2, nome: 'Memorando', criadoEm: DateTime.now()), - Documento(id: 3, nome: 'Paper', criadoEm: DateTime.now()), - Documento(id: 4, nome: 'Artigo', criadoEm: DateTime.now()), - Documento(id: 5, nome: 'TCC', criadoEm: DateTime.now()), - Documento(id: 6, nome: 'oficio', criadoEm: DateTime.now()), - Documento(id: 7, nome: 'nota fiscal', criadoEm: DateTime.now()), - ]; - - late final Categoria categoria; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("2File"), - ), - body: Column( - children: [ - Container( - padding: EdgeInsets.all(20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Text( - 'Categoria', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - CategoriaList(_documentosList) - ], - )); - } -} diff --git a/lib/pages/newCategoriaPage.dart b/lib/pages/newCategoriaPage.dart new file mode 100644 index 0000000..9ac52d1 --- /dev/null +++ b/lib/pages/newCategoriaPage.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class NewCategoriaPage extends StatefulWidget { + const NewCategoriaPage({Key? key}) : super(key: key); + + @override + State createState() => _CategoriaPageState(); +} + +class _CategoriaPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xffF5F5F5), + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: const Text('Adicionar Categoria'), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/notificacaoPage.dart b/lib/pages/notificacaoPage.dart new file mode 100644 index 0000000..dd84140 --- /dev/null +++ b/lib/pages/notificacaoPage.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; + +import '../database/database_config.dart'; +import '../models/notificacao.dart'; + +class Notificacoes extends StatefulWidget { + const Notificacoes({super.key}); + + @override + State createState() => _NotificacoesState(); +} + +class _NotificacoesState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Notificações'), + ), + body: Center( + child: FutureBuilder>( + future: DatabaseHelper.instance.listNotificacoes(), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + return snapshot.data!.isEmpty + ? const Center( + child: Text('Lista de notificações vazia.'), + ) + : ListView( + children: snapshot.data!.map((notify) { + return Center( + child: Card( + color: const Color(0xffDEF1EB), + child: Column( + children: [ + ListTile( + contentPadding: EdgeInsets.all(10.0), + subtitle: const Text( + 'O documento x venceu hoje - data - ', + style: TextStyle(fontSize: 15), + ), + isThreeLine: true, + ), + ], + ), + ), + ); + }).toList(), + ); + }), + )); + } +} diff --git a/lib/pages/pesquisaPage.dart b/lib/pages/pesquisaPage.dart new file mode 100644 index 0000000..28b0100 --- /dev/null +++ b/lib/pages/pesquisaPage.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class PesquisaPage extends StatefulWidget { + const PesquisaPage({Key? key}) : super(key: key); + + @override + State createState() => _CategoriaPageState(); +} + +class _CategoriaPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xffF5F5F5), + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: const Text('Pesquisar documento'), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/sobrePage.dart b/lib/pages/sobrePage.dart new file mode 100644 index 0000000..68a2719 --- /dev/null +++ b/lib/pages/sobrePage.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class SobrePage extends StatefulWidget { + const SobrePage({Key? key}) : super(key: key); + + @override + State createState() => _CategoriaPageState(); +} + +class _CategoriaPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xffF5F5F5), + appBar: AppBar( + backgroundColor: const Color(0xff0C322C), + title: const Text('Sobre'), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/sogrePage.dart b/lib/pages/sogrePage.dart new file mode 100644 index 0000000..eccf128 --- /dev/null +++ b/lib/pages/sogrePage.dart @@ -0,0 +1,16 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SobrePage extends StatelessWidget { + const SobrePage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: Column( + children: [], + ), + ); + } +} diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..f419d26 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import path_provider_macos +import sqflite func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) } diff --git a/pubspec.lock b/pubspec.lock index dabce23..b5b3bd3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.5" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" async: dependency: transitive description: @@ -22,6 +36,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" clock: dependency: transitive description: @@ -36,6 +64,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -50,11 +92,32 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.4" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.0" flutter_lints: dependency: "direct dev" description: @@ -62,11 +125,23 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.2" intl: dependency: "direct main" description: @@ -74,6 +149,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "4.7.0" lints: dependency: transitive description: @@ -109,6 +198,90 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.2" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.22" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.7" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + pointycastle: + dependency: transitive + description: + name: pointycastle + url: "https://pub.dartlang.org" + source: hosted + version: "3.6.2" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -121,6 +294,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0+2" stack_trace: dependency: transitive description: @@ -142,6 +329,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.1" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0+3" term_glyph: dependency: transitive description: @@ -156,6 +350,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.12" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" vector_math: dependency: transitive description: @@ -163,5 +364,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.2" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.2" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+2" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" sdks: dart: ">=2.18.2 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index f93db59..28b4bb3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,9 @@ -name: first_app +name: to_file description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.18.2 <3.0.0' + sdk: ">=2.18.2 <3.3.9" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -31,14 +31,16 @@ environment: dependencies: flutter: sdk: flutter - + flutter_localizations: + sdk: flutter intl: ^0.17.0 - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + sqflite: ^2.2.0+3 + path_provider: ^2.0.11 dev_dependencies: flutter_test: @@ -50,13 +52,13 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^2.0.0 + flutter_launcher_icons: "^0.10.0" # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. @@ -64,7 +66,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - - assets/images/ + - assets/images/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see diff --git a/test/widget_test.dart b/test/widget_test.dart index 308ed1e..5530623 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -7,13 +7,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; - -import 'package:first_app/main.dart'; +import 'package:to_file/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(TwoFileApp()); + await tester.pumpWidget(const TwoFileApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget);