Skip to content

Instantly share code, notes, and snippets.

@ybakos
Created January 22, 2020 00:04
Show Gist options
  • Select an option

  • Save ybakos/badad377e248987ff0b8e424a3ae0233 to your computer and use it in GitHub Desktop.

Select an option

Save ybakos/badad377e248987ff0b8e424a3ae0233 to your computer and use it in GitHub Desktop.
CS 492 Week 5 Exploration 1 Exercise
Look for the occurrences of FIXME.
FIXME 1
Be sure the data type is correct.
FIXME 2
Remember the best practice.
FIXME 3
Remember to invoke super.
FIXME 4
Be sure the method signature is correct.
FIXME 5
What should it do with this widget?
import 'package:flutter/material.dart';
void main() {
runApp(PuppyApp(puppyName: 'Fido'));
}
abstract class PuppyApp { // FIXME 1
final String puppyName;
/* FIXME 2 */ PuppyApp({Key key, this.puppyName}) : /* FIXME 3 */ ;
@override
void build() { /* FIXME 4 */
Center(child: Text('$puppyName', textDirection: TextDirection.ltr)); /* FIXME 5 */
}
}
import 'package:flutter/material.dart';
void main() {
runApp(PuppyApp(puppyName: 'Fido'));
}
class PuppyApp extends StatelessWidget { // FIXED: Extend StatelessWidget
final String puppyName;
// FIXED: Define a const constructor
const PuppyApp({Key key, this.puppyName}) : super(key: key); // FIXED: Invoke super.
@override
Widget build(BuildContext context) { // FIXED: Return a Widget, receive a BuildContext.
return Center(child: Text('$puppyName', textDirection: TextDirection.ltr));
} // FIXED: Return the widget
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment