This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import MaterialApp and other widgets which we can use to quickly create a material app | |
import 'package:flutter/material.dart'; | |
// Code written in Dart starts exectuting from the main function. runApp is part of | |
// Flutter, and requires the component which will be our app's container. In Flutter, | |
// every component is known as a "widget". | |
void main() => runApp(new TodoApp()); | |
// Every component in Flutter is a widget, even the whole app itself | |
class TodoApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Much like _addTodoItem, this modifies the array of todo strings and | |
// notifies the app that the state has changed by using setState | |
void _removeTodoItem(int index) { | |
setState(() => _todoItems.removeAt(index)); | |
} | |
// Show an alert dialog asking the user to confirm that the task is done | |
void _promptRemoveTodoItem(int index) { | |
showDialog( | |
context: context, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instead of autogenerating a todo item, _addTodoItem now accepts a string | |
void _addTodoItem(String task) { | |
// Only add the task if the user actually entered something | |
if(task.length > 0) { | |
setState(() => _todoItems.add(task)); | |
} | |
} | |
Widget build(BuildContext context) { | |
return new Scaffold( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoListState extends State<TodoList> { | |
List<String> _todoItems = []; | |
// This will be called each time the + button is pressed | |
void _addTodoItem() { | |
// Putting our code inside "setState" tells the app that our state has changed, and | |
// it will automatically re-render the list | |
setState(() { | |
int index = _todoItems.length; | |
_todoItems.add('Item ' + index.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import MaterialApp and other widgets which we can use to quickly create a material app | |
import 'package:flutter/material.dart'; | |
void main() => runApp(new TodoApp()); | |
class TodoApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Todo List', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import MaterialApp and other widgets which we can use to quickly create a material app | |
import 'package:flutter/material.dart'; | |
// Code written in Dart starts exectuting from the main function. runApp is part of | |
// Flutter, and requires the component which will be our app's container. In Flutter, | |
// every component is known as a "widget". | |
void main() => runApp(new TodoApp()); | |
// Every component in Flutter is a widget, even the whole app itself | |
class TodoApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
describe('Screenshots', () => { | |
it('shows text is visible', () => { | |
browser.timeouts('implicit', 5000); | |
// We need to switch to the native context for the screenshot to work | |
browser.context('NATIVE_APP'); | |
// browser.screenshot returns the screenshot as a base64 string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.config = { | |
// 4723 is the default port for Appium | |
port: 4723, | |
// How much detail should be logged. The options are: | |
// 'silent', 'verbose', 'command', 'data', 'result', 'error' | |
logLevel: 'error', | |
// This defines which kind of device we want to test on, as well as how it should be | |
// configured. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> | |
<link rel="stylesheet" type="text/css" href="css/index.css"> | |
<title>Appium Test</title> | |
</head> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
document.querySelector('#showHideButton').addEventListener('click', function() { |