62 lines
2.0 KiB
Dart
62 lines
2.0 KiB
Dart
import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
|
import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class TestPage extends StatelessWidget {
|
|
const TestPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Exemplo de dados para os HashMaps
|
|
final Map<String, String> labelsHashMap = {
|
|
'Nome:': 'Gabriel da Silva',
|
|
'Entrada:': '08:00 AM 01/01/2022',
|
|
'Saída:': '17:00 PM 01/01/2022',
|
|
};
|
|
|
|
// Ajuste para o novo tipo esperado pelo componente
|
|
final Map<String, Color> statusHashMap = {
|
|
'Ativo': FlutterFlowTheme.of(context).success,
|
|
};
|
|
|
|
// função set statusHashMap que recebe um String status faz um switch case e retorna um Map<String, Color>
|
|
Map<String, Color> getStatusHashMap(String status) {
|
|
switch (status) {
|
|
case 'Ativo':
|
|
return {'Ativo': FlutterFlowTheme.of(context).success};
|
|
case 'Inativo':
|
|
return {'Inativo': FlutterFlowTheme.of(context).error};
|
|
default:
|
|
return {'Desconhecido': FlutterFlowTheme.of(context).primaryColor};
|
|
}
|
|
}
|
|
|
|
// Ajuste para passar os valores corretos para a URL da imagem
|
|
final Map<String, String> imageKeyValue = {
|
|
'key': 'docID',
|
|
'value': 'imageType',
|
|
};
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Test Page'),
|
|
),
|
|
body: Center(
|
|
child: ListView.builder(
|
|
itemCount: 10,
|
|
itemBuilder: (context, index) {
|
|
return CardItemTemplateComponentWidget(
|
|
labelsHashMap: labelsHashMap,
|
|
statusHashMap: statusHashMap,
|
|
imageHashMap: imageKeyValue,
|
|
onTapCardItemAction: () async {
|
|
// Ação ao tocar no card
|
|
print('Card tapped');
|
|
},
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|