Skip to content

Commit

Permalink
Merge pull request #2 from emanuel-braz/cert-valid
Browse files Browse the repository at this point in the history
feat: add certificate validation
  • Loading branch information
emanuel-braz authored Apr 24, 2024
2 parents 132d930 + 040f6c2 commit f89e268
Show file tree
Hide file tree
Showing 6 changed files with 812 additions and 13 deletions.
23 changes: 17 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_sp_social/presentation/home/home_page.dart';
import 'package:flutter_sp_social/presentation/sorteio/sorteio_page.dart';

import 'presentation/certificate/certificate_validation.dart';
import 'presentation/home/home_page.dart';
import 'presentation/sorteio/sorteio_page.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -16,17 +18,26 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
title: 'Flutter SP Social',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 43, 140, 220)),
colorScheme: ColorScheme.fromSeed(seedColor: const Color.fromARGB(255, 43, 140, 220)),
useMaterial3: true,
),
onGenerateRoute: (settings) {
switch (settings.name) {
String route = settings.name ?? '/';
if (route == '/') {
String? path = Uri.base.pathSegments.firstOrNull;
route = path ?? route;
}

switch (route) {
case 'sorteio':
return MaterialPageRoute(
builder: (context) => const SorteioPage(),
);
case '/':
case 'certificate':
return MaterialPageRoute(
builder: (context) => const CertificateValidation(),
);
case 'home':
default:
return MaterialPageRoute(
builder: (context) => const HomePage(),
Expand Down
42 changes: 42 additions & 0 deletions lib/presentation/certificate/certificate_validation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:easy_web_view/easy_web_view.dart';
import 'package:flutter/material.dart';

class CertificateValidation extends StatefulWidget {
const CertificateValidation({super.key});

@override
State<CertificateValidation> createState() => _CertificateValidationState();
}

class _CertificateValidationState extends State<CertificateValidation> {
late final String certValidation;
final ValueKey key = const ValueKey('key_0');

@override
void initState() {
super.initState();

certValidation = '${Uri.base.origin}/static/cert_validation.html';
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Validação de Certificado'),
leading: IconButton(
onPressed: () {
Navigator.pushNamed(context, 'home');
},
icon: const Icon(Icons.home),
),
),
body: EasyWebView(
src: certValidation,
key: key,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
),
);
}
}
1 change: 1 addition & 0 deletions lib/presentation/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class _HomePageState extends State<HomePage> {

return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text(
_store.value!.eventName,
style: Theme.of(context).textTheme.headlineSmall!.copyWith(
Expand Down
Loading

0 comments on commit f89e268

Please sign in to comment.