How to find path with Zendframework3? - ubuntu-16.04

I am using zendframework3 with nginad on ubuntu16, the index page is showing, but when I click on signup, add publisher etc. It couldn't find the route. I looked at the folder structure and configuration files as well as views it's there, but couldn't find out what's wrong. Here is the path:
/signup/customer
/signup/newuser
/auth/login
/company
/legal
Here is the configure file for DashboardManager module:
<?php
return array(
'router' => array(
'routes' => array(
'websites' => array(
'type' => 'segment',
'options' => array(
'route' =>
'/websites[/[:action[/[:param1[/]]]]]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Website',
'action' => 'index',
),
),
),
'users' => array(
'type' => 'segment',
'options' => array(
'route' => '/users[/[:action[/[:param1[/]]]]]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Signup',
'action' => 'account',
),
),
),
'pxsspdirectory' => array(
'type' => 'segment',
'options' => array(
'route' =>
'/directory[/[:action[/[:param1[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' =>
'DashboardManager\Controller',
'controller' =>
'DashboardManager\Controller\Services',
'action' => 'ssp',
),
),
),
'pxpublishers' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publishers/websites[/]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Publisher',
'action' => 'pxpublishers',
),
),
),
'pxpublisherslist' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/websites/list/[:param1[/]]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Website',
'action' => 'pxlist',
),
),
),
'pxwebsitelist' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publisher/websites[/]',
'defaults' => array(
'controller' => '
DashboardManager\Controller\Website',
'action' => 'pxwebsitelist',
),
),
),
'pxnewpublisher' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publishers/add[/]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Signup',
'action' => 'pxnewpublisher',
),
),
),
'pxloginaspublisher' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publishers/loginasdomain[/]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Publisher',
'action' => 'loginasdomain',
),
),
),
'pxpublisherlist' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publishers/list[/]',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Signup',
'action' => 'publishersdomain',
),
),
),
'pxnewpublisheradd' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-
exchange/publishers/new[/]',
'defaults' => array(
'__NAMESPACE__' =>
'DashboardManager\Controller',
'controller' =>
'DashboardManager\Controller\Signup',
'action' => 'pxnewuser',
),
),
),
'company' => array(
'type' => 'segment',
'options' => array(
'route' => '/company',
'defaults' => array(
'controller' =>
'DashboardManager\Controller\Company',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'action' => array(
'type' => 'segment',
'options' => array(
'route' => '/:action',
'constraints' => array(
//'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Company',
'action' => 'index',
),
),
),
'press' => array(
'type' => 'segment',
'options' => array(
'route' => '/press/releases/:param1',
'constraints' => array(
//'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Company',
'action' => 'pressinner',
),
),
),
'jobs' => array(
'type' => 'segment',
'options' => array(
'route' => '/jobs/post/:param1',
'constraints' => array(
//'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Company',
'action' => 'jobsinner',
),
),
),
'jobform' => array(
'type' => 'segment',
'options' => array(
'route' => '/jobs/post/apply/:param1',
'constraints' => array(
//'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Company',
'action' => 'jobform',
),
),
),
),
),
'signup' => array(
'type' => 'segment',
'options' => array(
'route' => '/signup[/[:action[/[:param1[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Signup',
'action' => 'index',
),
),
),
'signup-index' => array(
'type' => 'segment',
'options' => array(
'route' => '/',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Signup',
'action' => 'index',
),
),
),
'manager' => array(
'type' => 'segment',
'options' => array(
'route' => '/manager[/[:action[/[:param1[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Manager',
'action' => 'index',
),
),
),
'report' => array(
'type' => 'segment',
'options' => array(
'route' => '/report[/[:action[/[:param1[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Report',
'action' => 'index',
),
),
),
'private-exchange' => array(
'type' => 'segment',
'options' => array(
'route' => '/private-exchange[/[:action[/[:param1[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Demand',
'action' => 'index',
),
),
),
'publisher' => array(
'type' => 'Literal',
'options' => array(
'route' => '/publisher',
'defaults' => array(
'controller' => 'DashboardManager\Controller\Publisher',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'process' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:action[/[:param1[/]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Publisher',
'action' => 'index',
),
),
),
'zone' => array(
'type' => 'segment',
'options' => array(
'route' => '/zone/:param1[/[:action[/[:id[/]]]]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'param1' => '[0-9]+',
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'DashboardManager\Controller',
'controller' => 'DashboardManager\Controller\Zone',
'action' => 'index',
),
),
),
),
),
'login' => array(
'type' => 'Literal',
'options' => array(
'route' => '/auth',
'defaults' => array(
'controller' => 'DashboardManager\Controller\Auth',
'action' => 'login',
),
),
'may_terminate' => true,
'child_routes' => array(
'process' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:action]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
'msa' => array(
'type' => 'segment',
'options' => array(
'route' => '/auth/msa[/[:param1[/]]]',
'constraints' => array(
'param1' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'DashboardManager\Controller\Auth',
'action' => 'msa',
),
),
),
),
),
'service_manager' => array(
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
'Zend\Authentication\AuthenticationService' => function($sm) {
//return new Zend\Authentication\AuthenticationService(); // Built-in ZF2 Authentication Service.
return $sm->get('AuthService'); // Custom Authentication Service.
},
),
),
'translator' => array(
'locale' => 'en_US',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'controllers' => array(
'invokables' => array(
'DashboardManager\Controller\Company' => 'DashboardManager\Controller\CompanyController',
'DashboardManager\Controller\Signup' => 'DashboardManager\Controller\SignupController',
'DashboardManager\Controller\Manager' => 'DashboardManager\Controller\ManagerController',
'DashboardManager\Controller\Demand' => 'DashboardManager\Controller\DemandController',
'DashboardManager\Controller\Publisher' => 'DashboardManager\Controller\PublisherController',
'DashboardManager\Controller\Auth' => 'DashboardManager\Controller\AuthController',
'DashboardManager\Controller\Success' => 'DashboardManager\Controller\SuccessController',
'DashboardManager\Controller\Report' => 'DashboardManager\Controller\ReportController',
'DashboardManager\Controller\Zone' => 'DashboardManager\Controller\ZoneController',
'DashboardManager\Controller\Website' => 'DashboardManager\Controller\WebsiteController',
'DashboardManager\Controller\Services' => 'DashboardManager\Controller\ServicesController'
),
),
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'unauthorized_template' => __DIR__ . '/../view/error/403.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
// 'manager' => __DIR__ . '/../view',
// 'private-exchange' => __DIR__ . '/../view',
),
)
);
?>

Related

Extract routes into separate dart files

I have a list of routes with more than 50 lines and I wish to simplify it because it is very long and messy. Below is the example of current routes. Is there anyway I can extract it into separate files? For example, put //2 in routes2.dart file and //3 in routes3.dart file? How do I call them back in MyApp?
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider( create: (_) => SettingsNotifier()),
ChangeNotifierProvider(create: (_) => InterstitialTimerNotifier()),
ChangeNotifierProvider(create: (_) => InterstitialReadyNotifier()),
ChangeNotifierProvider(create: (_) => PolicyNotifier()),
],
child: MaterialApp(
themeMode:ThemeMode.system,
theme: ThemeClass.lightTheme,
darkTheme: ThemeClass.darkTheme,
initialRoute: HomeScreen.id,
routes: {
//1. Home
HomeScreen.id: (context) => HomeScreen(),
//2. Puasa
PuasaScreen.id: (context) => PuasaScreen(),
DoaBerbuka.id: (context) => DoaBerbuka(),
NiatPuasa.id: (context) => NiatPuasa(),
WaktuMustajabDoa.id: (context) => WaktuMustajabDoa(),
PuasaPengenalanScreen.id: (context) => PuasaPengenalanScreen(),
PuasaReference.id: (context) => PuasaReference(),
//3. Solat Tarawih
TarawihScreen.id: (context) => TarawihScreen(),
TarawihPengenalanScreen.id: (context) => TarawihPengenalanScreen(),
TarawihNiat.id:(context) => TarawihNiat(),
TarawihTakrif.id: (context) => TarawihTakrif(),
TarawihDalilScreen.id: (context) => TarawihDalilScreen(),
TarawihHukum.id: (context) => TarawihHukum(),
TarawihReference.id: (context) => TarawihReference(),
TarawihWaktuSolat.id: (context) => TarawihWaktuSolat(),
TarawihKelebihanScreen.id: (context) => TarawihKelebihanScreen(),
TarawihBilanganRakaat.id: (context) => TarawihBilanganRakaat(),
Tarawih8Screen.id: (context) => Tarawih8Screen(),
Tarawih8TatacaraScreen.id: (context) => Tarawih8TatacaraScreen(),
//4. Solat Witir
Tarawih8WitirScreen.id: (context) => Tarawih8WitirScreen(),
Tarawih8WitirRakaat1.id: (context) => Tarawih8WitirRakaat1(),
Tarawih8WitirRakaat2.id: (context) => Tarawih8WitirRakaat2(),
Tarawih8WitirRakaat3.id: (context) => Tarawih8WitirRakaat3(),
TarawihTahlil.id: (context) => TarawihTahlil(),
//There're more routes after this
}),
);
}
}
routes: takes Map<String, WidgetBuilder>, you can create
a dart file and create a map like,
final Map<String, WidgetBuilder> route2 = {
PuasaScreen.id: (context) => PuasaScreen(),
.....
};
same goes for routes3.dart.
and you can add theses routes on MaterialApp like
return MaterialApp(
routes: {
HomeScreen.id: (context) => HomeScreen(),
...route2, /// variable name
...route3,
},
);
This is the updated code after applying suggestions from #OMiShah.
I created new dart files for the routes. For example, route_puasa.dart:
import ...
Map routes_puasa = {
PuasaScreen.id: (context) => PuasaScreen(),
DoaBerbuka.id: (context) => DoaBerbuka(),
NiatPuasa.id: (context) => NiatPuasa(),
WaktuMustajabDoa.id: (context) => WaktuMustajabDoa(),
PuasaPengenalanScreen.id: (context) => PuasaPengenalanScreen(),
PuasaReference.id: (context) => PuasaReference(),
};
Then call it in MyApp using ... Spread Operator
routes: {
...routes_puasa,
...route_tarawih,
...routes_tarawih20,
...routes_zakat,
}
Works perfectly!

I have been running an andriod simulation . this is has been my error every time

I have this graduation project . I converted my figma to flutter(dart). I have running an andriod simulation on intelli jetbrains. however i keep getting this error :
"Could not find a generator for route RouteSettings("/", null) in the _WidgetsAppStat
If u can help me out it would be greatly appreciated.
This is the code if u could help it would be really great. I am trying to see if my figma design is being implemented properly. I have been running a hundred of times.
The full main.dart code is posted below:
void main() {
runApp(Covid_19_20AppApp());
}
class Covid_19_20AppApp extends StatelessWidget {
get generateRoute => null;
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Covid-19',
theme: ThemeData(
primarySwatch: Colors.blue,
),
initialRoute: '/GeneratedAndroid1Widget',
onGenerateRoute:generateRoute,
routes: {
'/GeneratedAndroid5Widget': (context) => GeneratedAndroid5Widget(),
'/GeneratedAndroid13Widget': (context) => GeneratedAndroid13Widget(),
'/GeneratedAndroid16Widget': (context) => GeneratedAndroid16Widget(),
'/GeneratedAndroid20Widget': (context) => GeneratedAndroid20Widget(),
'/GeneratedAndroid23Widget': (context) => GeneratedAndroid23Widget(),
'/GeneratedAndroid25Widget': (context) => GeneratedAndroid25Widget(),
'/GeneratedAndroid29Widget': (context) => GeneratedAndroid29Widget(),
'/GeneratedLowWidget12': (context) => GeneratedLowWidget12(),
'/GeneratedModerateWidget12': (context) => GeneratedModerateWidget12(),
'/GeneratedAndroid6Widget': (context) => GeneratedAndroid6Widget(),
'/GeneratedHoverStateWidget': (context) => GeneratedHoverStateWidget(),
'/GeneratedPlaceholderTextWidget7': (context) => GeneratedPlaceholderTextWidget7(),
'/GeneratedListBoxtitleWidget7': (context) => GeneratedListBoxtitleWidget7(),
'/GeneratedTextWidget': (context) => GeneratedTextWidget(),
'/GeneratedListboxComponentWidget7': (context) =>
GeneratedListboxComponentWidget7(),
'/GeneratedListboxComponentWidget8': (context) =>
GeneratedListboxComponentWidget8(),
'/GeneratedListboxComponentWidget9': (context) =>
GeneratedListboxComponentWidget9(),
'/GeneratedListboxComponentWidget10': (context) =>
GeneratedListboxComponentWidget10(),
'/GeneratedComponent1Widget1': (context) => GeneratedComponent1Widget1(),
'/GeneratedComponent3Widget1': (context) => GeneratedComponent3Widget1(),
'/GeneratedComponent8Widget': (context) => GeneratedComponent8Widget(),
'/GeneratedTextWidget1': (context) => GeneratedTextWidget1(),
'/GeneratedComponent2Widget': (context) => GeneratedComponent2Widget(),
'/GeneratedVectorWidget218': (context) => GeneratedVectorWidget218(),
'/GeneratedVectorWidget219': (context) => GeneratedVectorWidget219(),
'/GeneratedTextboxuncheckedWidget6': (context) =>
GeneratedTextboxuncheckedWidget6(),
'/GeneratedTextboxuncheckedWidget7': (context) =>
GeneratedTextboxuncheckedWidget7(),
'/GeneratedTextboxuncheckedWidget8': (context) =>
GeneratedTextboxuncheckedWidget8(),
'/GeneratedTextboxuncheckedWidget9': (context) =>
GeneratedTextboxuncheckedWidget9(),
'/GeneratedTextboxuncheckedWidget10': (context) =>
GeneratedTextboxuncheckedWidget10(),
'/GeneratedTextboxuncheckedWidget11': (context) =>
GeneratedTextboxuncheckedWidget11(),
'/GeneratedTextboxuncheckedWidget12': (context) =>
GeneratedTextboxuncheckedWidget12(),
'/GeneratedTextboxuncheckedWidget13': (context) =>
GeneratedTextboxuncheckedWidget13(),
'/GeneratedTextboxuncheckedWidget14': (context) =>
GeneratedTextboxuncheckedWidget14(),
'/GeneratedTextboxuncheckedWidget15': (context) =>
GeneratedTextboxuncheckedWidget15(),
'/GeneratedTextboxuncheckedWidget16': (context) =>
GeneratedTextboxuncheckedWidget16(),
'/GeneratedTextboxuncheckedWidget17': (context) =>
GeneratedTextboxuncheckedWidget17(),
'/GeneratedTextboxuncheckedWidget18': (context) =>
GeneratedTextboxuncheckedWidget18(),
'/GeneratedTextboxuncheckedWidget19': (context) =>
GeneratedTextboxuncheckedWidget19(),
'/GeneratedTextWidget2': (context) => GeneratedTextWidget2(),
'/GeneratedTextboxuncheckedWidget20': (context) =>
GeneratedTextboxuncheckedWidget20(),
'/GeneratedTextWidget3': (context) => GeneratedTextWidget3(),
'/GeneratedComponent4Widget1': (context) => GeneratedComponent4Widget1(),
'/GeneratedComponent7Widget1': (context) => GeneratedComponent7Widget1(),
'/GeneratedComponent5Widget1': (context) => GeneratedComponent5Widget1(),
'/GeneratedComponent6Widget3': (context) => GeneratedComponent6Widget3(),
'/GeneratedEllipse98Widget282': (context) => GeneratedEllipse98Widget282(),
'/GeneratedCheck_circleWidget': (context) => GeneratedCheck_circleWidget(),
'/GeneratedCheck_circleWidget1': (context) => GeneratedCheck_circleWidget1(),
'/GeneratedTEXTBARWidget15': (context) => GeneratedTEXTBARWidget15(),
'/GeneratedTEXTBARWidget16': (context) => GeneratedTEXTBARWidget16(),
'/GeneratedTEXTBARWidget17': (context) => GeneratedTEXTBARWidget17(),
'/GeneratedTEXTBARWidget18': (context) => GeneratedTEXTBARWidget18(),
'/GeneratedTEXTBARWidget19': (context) => GeneratedTEXTBARWidget19(),
'/GeneratedTEXTBARWidget20': (context) => GeneratedTEXTBARWidget20(),
'/GeneratedTEXTBARWidget21': (context) => GeneratedTEXTBARWidget21(),
'/GeneratedTEXTBARWidget22': (context) => GeneratedTEXTBARWidget22(),
'/GeneratedTEXTBARWidget23': (context) => GeneratedTEXTBARWidget23(),
'/GeneratedTEXTBARWidget24': (context) => GeneratedTEXTBARWidget24(),
'/GeneratedTEXTBARWidget25': (context) => GeneratedTEXTBARWidget25(),
},
);
}
}
Try removing this line from your code-
onGenerateRoute:generateRoute,
Also add this route in your routes section -
/GeneratedAndroid1Widget.
It should work fine then.

Ionic does not execute canActivate on route on android

this runs as expected running ionic serve, but when i deploy it to andoid it just sits on my 'home' screen at launch.
edit: this works as expected on the emulator, but when debugging on a device (Galaxy S9+) it fails.
#Injectable()
export class AuthGuard implements CanActivate {
constructor(private _api: ApiService, private _router: Router) { }
canActivate(): Observable<boolean | UrlTree> {
return this._api.isLoggedIn().pipe(
map(r => {
if (r){
return true;
}
else{
const tree: UrlTree = this._router.parseUrl("login");
return tree;
}
})
);
}
}
const routes: Routes = [
{
path: '',
loadChildren: () => import('./tabs/tabs.module').then( m => m.TabsPageModule)
},
{
path: 'login',
loadChildren: () => import('./login/login.module').then( m => m.LoginPageModule)
}
];
#NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
const routes: Routes = [
{
path: '',
component: TabsPage,
canActivate: [AuthGuard],
children: [
{
path: 'home',
loadChildren: () => import('../home/home.module').then(m => m.HomePageModule)
},
{
path: 'tab2',
loadChildren: () => import('../tab2/tab2.module').then(m => m.Tab2PageModule)
},
{
path: 'tab3',
loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule)
},
{
path: "settings",
loadChildren: ()=>import("../settings/settings.module").then(m=>m.SettingsPageModule)
},
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
}
]
},
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
}
];
#NgModule({
imports: [RouterModule.forChild(routes)],
providers:[AuthGuard]
})
export class TabsPageRoutingModule {}

FLUTTER: The method 'map' was called on null

the problem is in this line:
...(mapsystem[perguntaid]['respostas'] as List<String>)
.map((resposta) {
return Resposta(respondendo, resposta);
}).toList()
"Resposta" is a widget in other file that returns a raised button, but this is not the problem
Also, it gaves no errors in problems output, just in the emulator when i run the app
import 'package:flutter/material.dart';
import './pergunta.dart';
import './resposta.dart';
void main() {
runApp(App());
}
class App extends StatefulWidget {
#override
State<StatefulWidget> createState() {
return AppState();
}
}
class AppState extends State<App> {
double score = 0;
var perguntaid = 0;
void respondendo() {
setState(() {
perguntaid = perguntaid + 1;
});
score = score + 0.5;
print(score);
}
#override
Widget build(BuildContext context) {
var mapsystem = [
{
'Tema': 'Memória',
'repostas': [
'Não há perda de memória óbvia. Apenas alguns esquecimentos que não fazem diferença',
'Esquecimento leve e regular de eventos (Esquece compromissos, repete perguntas, etc)',
'Perda de memória de leve a moderada, esquece de eventos recentes, o que atrapalha atividades diárias',
'Perda de memória moderada a severa, informações recentes são rapidamente esquecidas e lembra custa um significante esforço',
'Perda de memória severa, quase impossível lembrar novas informações, e memórias passadas podem estar afetadas'
],
},
{
'Tema': 'Orientação',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Tomada de decisões e resolução de problemas',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Atividades fora de casa',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Habilidades em casa e Hobbies',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Hábitos de Higiene pessoal',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Mudanças de comportameto e personalidade',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Habilidades de linguagem e comunicação',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Humor',
'repostas': ['1', '2', '3', '4', '5'],
},
{
'Tema': 'Atenção e Concentração',
'repostas': ['1', '2', '3', '4', '5'],
},
];
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Memory Mate'),
),
body: Column(
children: [
Pergunta(
mapsystem[perguntaid]['Tema'],
),
...(mapsystem[perguntaid]['respostas'] as List<String>)
.map((resposta) {
return Resposta(respondendo, resposta);
}).toList()
],
),
),
);
}
}
here is a picture of the error in screen:
link to the image
In your data, you have the key repostas, while on the error line you write respostas with an extra "s". Just change to mapsystem[perguntaid]['repostas'].

I have some issue with my routing on Zend Framework 3

I have installed Zend Framework 3, and I dont know how access controller.
this is my url:
http://localhost/catalog
route:
<?php
namespace Application;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
use Zend\ServiceManager\Factory\InvokableFactory;
return [
'router' => [
'routes' => [
'home' => [
'type' => Literal::class,
'options' => [
'route' => '/',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
'catalog' => [
'type' => Segment::class,
'options' => [
'route' => '/catalog[/:action]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
],
],
'controllers' => [
'factories' => [
Controller\IndexController::class => InvokableFactory::class,
],
],
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
];
What am I doing wrong?
I tried to find a Zend Framework 3 guide on the internet and I didn't find anything.