Todo listo para añadir la funcionalidad de escoger archivo

parent 8f8b1790
import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget {
final actionButtonTypes tipoBoton;
final ActionButtonTypes tipoBoton;
final VoidCallback? onPressed;
const ActionButton({super.key, required this.onPressed,
required this.label, required this.icon});
ActionButton({super.key, required this.tipoBoton, required this.onPressed});
@override
Widget build(BuildContext context) {
......@@ -14,24 +13,24 @@ class ActionButton extends StatelessWidget {
textDirection: TextDirection.rtl,
child: FilledButton.icon(
onPressed: onPressed,
label: Text(label, textScaler: const TextScaler.linear(1.2)),
icon: icon,
label: Text(tipoBoton.label, textScaler: const TextScaler.linear(1.2)),
icon: tipoBoton.icon,
),
);
}
}
enum actionButtonTypes {
ARCHIVO('Archivo', Icon(Icons.description_outlined)),
CARPETA('Carpeta', Icon(Icons.folder_outlined)),
ENLACE('Enlace', Icon(Icons.link_outlined)),
COPIAR('Copiar', Icon(Icons.copy)),
COMPRIMIR('Comprimir', Icon(Icons.splitscreen_outlined)),
REEMPLAZAR('Reemplazar', Icon(Icons.change_circle_outlined));
enum ActionButtonTypes {
archivo('Archivo', Icon(Icons.description_outlined)),
carpeta('Carpeta', Icon(Icons.folder_outlined)),
enlace('Enlace', Icon(Icons.link_outlined)),
copiar('Copiar', Icon(Icons.copy)),
comprimir('Comprimir', Icon(Icons.splitscreen_outlined)),
reemplazar('Reemplazar', Icon(Icons.change_circle_outlined));
final String label;
final Icon icon;
const actionButtonTypes(this.label, this.icon);
const ActionButtonTypes(this.label, this.icon);
}
\ No newline at end of file
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import './action_button.dart';
......@@ -51,6 +52,24 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
);
}
List<Widget> _loadConvertirActionButtons (BuildContext context) {
final buttons = <Widget>[
ActionButton(
tipoBoton: ActionButtonTypes.copiar,
onPressed: () {},
),
ActionButton(
tipoBoton: ActionButtonTypes.reemplazar,
onPressed: () {}
),
ActionButton(
tipoBoton: ActionButtonTypes.comprimir,
onPressed: () {}
)
];
return buttons;
}
List<Widget> _buildFABs() {
final toRet = <Widget>[];
......@@ -83,13 +102,6 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
],
));
List<Widget> _loadConvertirActionButtons(BuildContext context){
final buttons = <Widget>[];
return buttons;
}
// FAB con las opciones para agregar archivos, carpetas, enlaces...
toRet.add(Stack(
......@@ -122,8 +134,27 @@ class _ConVertexFabBarState extends State<ConVertexFabBar> {
}
List<Widget> _loadAgregarActionButtons(BuildContext context){
final buttons = <Widget>[];
final buttons = <Widget>[
ActionButton(
tipoBoton: ActionButtonTypes.enlace,
onPressed: () {}
),
ActionButton(
tipoBoton: ActionButtonTypes.carpeta,
onPressed: () {}
),
ActionButton(
tipoBoton: ActionButtonTypes.archivo,
onPressed: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
String filePath = result.files.single.path!;
} else {
//
}
},
),
];
return buttons;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment