Skip to content

Instantly share code, notes, and snippets.

@cornwe19
Last active July 1, 2022 14:12
Show Gist options
  • Save cornwe19/fbb62d33cf36aa55c6f123b014cb2d4f to your computer and use it in GitHub Desktop.
Save cornwe19/fbb62d33cf36aa55c6f123b014cb2d4f to your computer and use it in GitHub Desktop.
Nimble Flutter Interview
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Text("Hello world", style: Theme.of(context).textTheme.headline4);
}
}
Future<List<Prescription>> loadPrescriptions() async {
return [
Prescription(id: "Rx-abc123", medicationName: "Tylenol", cost: 25.00),
Prescription(id: "Rx-def456", medicationName: "Motrin", cost: 15.00),
Prescription(id: "Rx-ghi789", medicationName: "Sudafed", cost: 13.00),
];
}
Future<List<Coupon>> loadCoupons() async {
return [
Coupon(id: "C-cba321", prescriptionId: "Rx-abc123", discount: 4.00),
Coupon(id: "C-fed654", prescriptionId: "Rx-ghi789", discount: 7.00),
Coupon(id: "C-ihg987", prescriptionId: "Rx-ghi789", discount: 8.00),
];
}
class Prescription {
final String id;
final String medicationName;
final double cost;
Prescription({
required this.id,
required this.medicationName,
required this.cost,
});
}
class Coupon {
final String id;
final String prescriptionId;
final double discount;
Coupon({
required this.id,
required this.prescriptionId,
required this.discount
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment