From 61a89706bdd74c810535f4b51e7c520d4e7e8493 Mon Sep 17 00:00:00 2001 From: Willian <47341070+wjrcode@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:08:00 -0300 Subject: [PATCH] habito --- lib/Controller/HabitoController.dart | 3 +- lib/components/selectData.dart | 3 + lib/components/selectDias.dart | 1 + lib/main copy 2.dart | 178 --------------------------- lib/main copy.dart | 175 -------------------------- 5 files changed, 6 insertions(+), 354 deletions(-) delete mode 100644 lib/main copy 2.dart delete mode 100644 lib/main copy.dart diff --git a/lib/Controller/HabitoController.dart b/lib/Controller/HabitoController.dart index ffa4810..44e74e4 100644 --- a/lib/Controller/HabitoController.dart +++ b/lib/Controller/HabitoController.dart @@ -18,7 +18,8 @@ class HabitoController extends Base { habitoId(int? value) => model.id = value; habitoNome(String? value) => model.nome = value.toString(); - habitoDataehora(String? value) => model.data = value.toString(); + habitoDataehora(String? value) => + {print('dfasfa ' + (value ?? '')), model.data = value.toString()}; habitoDias(List? value) => model.dias = value!.cast(); habitoCor(String? value) => model.cor = value.toString(); diff --git a/lib/components/selectData.dart b/lib/components/selectData.dart index 5b635a2..446845c 100644 --- a/lib/components/selectData.dart +++ b/lib/components/selectData.dart @@ -21,6 +21,9 @@ class SelectData extends StatefulWidget { class _SelectDataState extends State { @override Widget build(BuildContext context) { + if (widget.controller!.text.length > 6 && widget.apenasHora!) { + widget.controller!.text = widget.controller!.text.substring(11); + } return Padding( padding: const EdgeInsets.only(bottom: 16), child: Column( diff --git a/lib/components/selectDias.dart b/lib/components/selectDias.dart index 4675a97..60468e0 100644 --- a/lib/components/selectDias.dart +++ b/lib/components/selectDias.dart @@ -24,6 +24,7 @@ class _SelectDiaState extends State { void initState() { super.initState(); teste = widget.diaAtual!; + widget.dia(teste); } @override diff --git a/lib/main copy 2.dart b/lib/main copy 2.dart deleted file mode 100644 index 1a77e03..0000000 --- a/lib/main copy 2.dart +++ /dev/null @@ -1,178 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:intl/date_symbol_data_local.dart'; -import 'package:organizei/components/card_item.dart'; -import 'package:intl/intl.dart'; - -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -String getSaudacao() { - int horaAtual = new DateTime.now().hour; - - if (horaAtual > 4 && horaAtual < 13) { - return 'Bom dia,'; - } else if (horaAtual > 12 && horaAtual < 19) { - return 'Boa tarde,'; - } else { - return 'Boa Noite,'; - } -} - -String getDia() { - DateTime data = new DateTime.now(); - - Intl.defaultLocale = 'pt_BR'; - initializeDateFormatting('pt_BR'); - - return DateFormat.MMMMd().format(data); -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - // appBar: AppBar( - // title: Text(widget.title), - // ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - getSaudacao(), - style: const TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.w100, - ), - ), - const Text( - 'Willian!', - style: TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - cardItem( - cor: Colors.green[200], - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - Text( - 'Hoje ', - style: TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - Text( - getDia(), - style: TextStyle( - color: Colors.black, - fontSize: 16, - fontWeight: FontWeight.w200, - ), - ), - ], - ), - ), - cardItem( - cor: Colors.pink, - nome: 'Correr', - horario: '09:30 até às 10:00', - ), - cardItem( - cor: Colors.red, - nome: 'Estudar inglês', - horario: '13:00 até às 15:00', - ), - cardItem( - cor: Colors.purple, - nome: 'Tomar vitamina D', - horario: '15:00', - ), - cardItem( - cor: Colors.yellow, - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - cardItem( - cor: Colors.lightBlue, - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - cardItem( - cor: Color(0xFFFFEBEE), - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - ], - ), - ), - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), - ); - } -} diff --git a/lib/main copy.dart b/lib/main copy.dart deleted file mode 100644 index b6923d1..0000000 --- a/lib/main copy.dart +++ /dev/null @@ -1,175 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:intl/date_symbol_data_local.dart'; -import 'package:organizei/components/card_item.dart'; -import 'package:intl/intl.dart'; - -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -String getSaudacao() { - int horaAtual = new DateTime.now().hour; - - if (horaAtual > 4 && horaAtual < 13) { - return 'Bom dia,'; - } else if (horaAtual > 12 && horaAtual < 19) { - return 'Boa tarde,'; - } else { - return 'Boa Noite,'; - } -} - -String getDia() { - DateTime data = new DateTime.now(); - - Intl.defaultLocale = 'pt_BR'; - initializeDateFormatting('pt_BR'); - - return DateFormat.MMMMd().format(data); -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - // appBar: AppBar( - // title: Text(widget.title), - // ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(8.0, 32.0, 8.0, 8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - getSaudacao(), - style: const TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.w100, - ), - ), - const Text( - 'Willian!', - style: TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - cardItem( - cor: Colors.green[200], - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - const Text( - 'Hoje ', - style: TextStyle( - color: Colors.black, - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - Text( - getDia(), - style: const TextStyle( - color: Colors.black, - fontSize: 16, - fontWeight: FontWeight.w200, - ), - ), - ], - ), - ), - Expanded( - child: ListView( - children: const [ - cardItem( - cor: Colors.pink, - nome: 'Correr', - horario: '09:30 até às 10:00', - ), - cardItem( - cor: Colors.red, - nome: 'Estudar inglês', - horario: '13:00 até às 15:00', - ), - cardItem( - cor: Colors.purple, - nome: 'Tomar vitamina D', - horario: '15:00', - ), - cardItem( - cor: Colors.yellow, - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - cardItem( - cor: Colors.lightBlue, - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - cardItem( - cor: Color(0xFFFFEBEE), - nome: 'Pular corda', - horario: '07:30 até às 09:00', - ), - ], - ), - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), - ); - } -}