Add FilePicker library and basic code
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void buttonPushed() {
|
||||
Future<void> selectFile() async {
|
||||
print("Button Pushed");
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||
|
||||
if (result != null) {
|
||||
//File file = File(result.files.single.path!);
|
||||
print(result.files.single.path!);
|
||||
} else {
|
||||
// User canceled the picker
|
||||
}
|
||||
}
|
||||
|
||||
class DayPage extends StatelessWidget {
|
||||
@@ -14,7 +25,7 @@ class DayPage extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
TextButton(onPressed: buttonPushed, child: Text("Select Input")),
|
||||
TextButton(onPressed: selectFile, child: Text("Select Input")),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: TextField(
|
||||
@@ -27,7 +38,7 @@ class DayPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [TextButton(onPressed: buttonPushed, child: Text("Run"))],
|
||||
children: [TextButton(onPressed: selectFile, child: Text("Run"))],
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
|
||||
Reference in New Issue
Block a user