From c8e7ef1671dfb6cb313a2171cce41ff84977b592 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Mon, 7 Jan 2019 10:43:56 +0100 Subject: [PATCH] Add a new Git app for testing the git commands --- lib/gitapp.dart | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/main.dart | 3 ++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 lib/gitapp.dart diff --git a/lib/gitapp.dart b/lib/gitapp.dart new file mode 100644 index 00000000..0e89b127 --- /dev/null +++ b/lib/gitapp.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class GitApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return new MaterialApp( + title: 'Git App', + home: Scaffold( + appBar: AppBar( + title: Text('Git Test'), + ), + body: Column( + children: buildGitButtons(), + ), + ), + ); + } +} + +buildGitButtons() { + return [ + RaisedButton( + child: Text("Remove Directory"), + onPressed: () { + print("FOO"); + }, + ), + RaisedButton( + child: Text("Git Clone"), + onPressed: () async { + await gitClone(); + }, + ), + RaisedButton( + child: Text("New File"), + onPressed: () { + print("FOO"); + }, + ), + ]; +} + +Future gitClone() async { + const platform = const MethodChannel('samples.flutter.io/battery'); + + print("Going to git clone"); + await platform.invokeMethod('gitClone', { + 'cloneUrl': "root@bcn.vhanda.in:git/notes", + 'filePath': "/", + }); + print("FOO"); +} diff --git a/lib/main.dart b/lib/main.dart index 953de157..a41bc0e3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; //import 'package:http/http.dart' as http; import 'package:journal/app.dart'; +import 'package:journal/gitapp.dart'; import 'package:journal/state_container.dart'; /* @@ -22,6 +23,6 @@ Future> fetchNotes() async { void main() { runApp(new StateContainer( - child: JournalApp(), + child: GitApp(), )); }