Skip to content

Commit

Permalink
updated UI
Browse files Browse the repository at this point in the history
  • Loading branch information
AravindhIppili committed Aug 4, 2021
1 parent cf17ca3 commit 86cfc16
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 23 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
tags:
- v*
name: Release Apk
jobs:
build:
name: Build Apk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.2.2'
- run: flutter pub get
- run: flutter build apk -t lib/main.dart --split-per-abi
- name: Release apk
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/*.apk"
token: ${{ secrets.QR_CODE }}
67 changes: 62 additions & 5 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
Barcode? barcodeResult;
final GlobalKey qrScanner = GlobalKey(debugLabel: 'QR');
QRViewController? controller;
IconData flashIcon = Icons.flash_off;
late AnimationController _animationController;
Tween<Offset> _tween = Tween(begin: Offset(0, -7), end: Offset(0, 7));
@override
void initState() {
super.initState();
_animationController =
AnimationController(duration: const Duration(seconds: 1), vsync: this);
_animationController.repeat(reverse: true);
}

@override
void reassemble() {
Expand All @@ -43,6 +52,36 @@ class _HomePageState extends State<HomePage> {
borderLength: 30,
cutOutBottomOffset: 1),
),
Container(
padding: EdgeInsets.all(10),
child: SlideTransition(
position: _tween.animate(CurvedAnimation(
parent: _animationController, curve: Curves.easeInOut)),
child: Container(
width: 250,
child: Divider(
thickness: 2,
color: Colors.red,
),
),
)
//TweenAnimationBuilder(
// tween: Tween<double>(begin: 0, end: 240),
// duration: Duration(seconds: 2),
// curve: Curves.decelerate,
// builder: (context, double val, child) {
// return Center(
// child: Container(
// margin: EdgeInsets.only(top: val),
// width: 250,
// child: Divider(
// thickness: 3,
// color: Colors.red,
// ),
// ),
// );
// }),
),
buildScannedOutput(),
buildFlashButton(),
Positioned(
Expand All @@ -53,7 +92,17 @@ class _HomePageState extends State<HomePage> {
Navigator.push(context,
MaterialPageRoute(builder: (context) => ViewScans()));
},
child: Text("View Scans")),
child: Row(
children: [
Icon(
Icons.qr_code,
color: Colors.white,
size: 20,
),
SizedBox(width: 4),
Text("View Scans"),
],
)),
),
),
],
Expand Down Expand Up @@ -89,11 +138,18 @@ class _HomePageState extends State<HomePage> {
Positioned buildScannedOutput() {
return Positioned(
bottom: 100,
left: 0,
right: 0,
child: Container(
alignment: Alignment.bottomCenter,
child: Text(
barcodeResult != null ? barcodeResult!.code : "Scan Something",
style: TextStyle(color: Colors.white, fontSize: 20),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
barcodeResult != null ? barcodeResult!.code : "Scan Something",
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 20),
),
)),
);
}
Expand All @@ -116,6 +172,7 @@ class _HomePageState extends State<HomePage> {
@override
void dispose() {
controller?.dispose();
_animationController.dispose();
super.dispose();
}
}
94 changes: 76 additions & 18 deletions lib/pages/view_scans.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:qrcode_scanner/data/scan_data.dart';

Expand All @@ -9,27 +11,83 @@ class ViewScans extends StatefulWidget {
}

class _ViewScansState extends State<ViewScans> {
final _random = Random();

Color? listColor() {
List<Color> _colors = [
Colors.amber,
Colors.cyan,
Colors.indigo,
Colors.red,
Colors.brown,
Colors.purple,
Colors.green,
Colors.orange,
Colors.teal,
];
return _colors[_random.nextInt(_colors.length-1)];
}


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
),
body: Container(
color: Colors.white,
child: ListView.builder(
itemCount: scannedData.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
scannedData[index].text,
style: TextStyle(
fontSize: 20
),),
trailing: Text(scannedData[index].time),
);
},
body: SafeArea(
child: Container(
child: ListView.builder(
itemCount: scannedData.length,
itemBuilder: (context, index) {
return Container(
color: Colors.white30,
child: ListTile(
leading: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: listColor(),
borderRadius: BorderRadius.circular(12),
),
child: Icon(
Icons.qr_code,
color: Colors.white,
size: 20,
),
),
],
),
minLeadingWidth: 10,
subtitle: Row(
children: [
Icon(
Icons.timer,
size: 12,
),
SizedBox(width: 2),
Text(
scannedData[index].time,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
],
),
title: Text(
scannedData[index].text,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
);
},
),
),
),
);
Expand Down

0 comments on commit 86cfc16

Please sign in to comment.