widget – Problema com GridView, Flutter

me perdi nos widgets do flutter, meu problema é com o Container/Center, quando eu tiro eles e deixo somente o GridView.builder a tela fica branca e quando deixo o Container/Center o Grid funciona, mas não da forma que eu quero, alguém sabe como resolver meu problema?

return Scaffold(
  drawer: Drawer(
    elevation: 0,
    child: ListView(),
  ),
  appBar: AppBar(
    iconTheme: IconThemeData(
      color: Color.fromARGB(255, 30, 87, 181),
    ),
    elevation: 0,
    backgroundColor: Colors.transparent,
    title: Row(
      crossAxisAlignment: CrossAxisAlignment.baseline,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: (
        Padding(
          padding: const EdgeInsets.only(right: 65),
          child: Text(
            'Books',
            style: GoogleFonts.roboto(
              textStyle: TextStyle(
                fontSize: 20,
                fontWeight: FontWeight.bold,
                color: Color.fromARGB(255, 30, 87, 181),
              ),
            ),
          ),
        ),
      ),
    ),
  ),
  body: SingleChildScrollView(
    child: SafeArea(
      child: Column(
        children: (
          SizedBox(height: Get.height * 0.01),
          Container(
            child: Image.asset('assets/images/admob_banner.jpg'),
          ),
          SizedBox(height: Get.height * 0.03),
          Padding(
            padding: EdgeInsets.only(
              left: Get.height * 0.05,
              right: Get.height * 0.05,
            ),
            child: TextField(
              autofocus: false,
              decoration: InputDecoration(
                contentPadding: new EdgeInsets.symmetric(
                    vertical: 8.0, horizontal: 8.0),
                prefixIcon: Icon(
                  Icons.search,
                  color: Colors.black,
                ),
                hintText: 'Pesquisa',
                fillColor: Colors.white,
                border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(20)),
                //fillColor: Colors.green
              ),
              keyboardType: TextInputType.emailAddress,
              style: GoogleFonts.roboto(
                textStyle: TextStyle(),
              ),
            ),
          ),
          SizedBox(height: Get.height * 0.06),
          Row(
            children: (
              Padding(
                padding: EdgeInsets.only(left: Get.height * 0.03),
                child: Text(
                  'Categorias',
                  style: GoogleFonts.roboto(
                    textStyle: TextStyle(
                      fontSize: 30,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
              ),
            ),
          ),
          Container(
            height: 200,
            child: Center(
              child: GridView.count(
                padding: EdgeInsets.only(left: Get.height * 0.025),
                shrinkWrap: true,
                scrollDirection: Axis.horizontal,
                crossAxisCount: 2,
                children: List.generate(
                  name.length,
                  (index) {
                    return Padding(
                      padding: EdgeInsets.all(8),
                      child: RaisedButton(
                        elevation: 0,
                        child: Text(name(index).toString()),
                        onPressed: () {},
                        shape: RoundedRectangleBorder(
                          side: BorderSide(color: Colors.black),
                          borderRadius: BorderRadius.circular(30.0),
                        ),
                      ),
                    );
                  },
                ),
              ),
            ),
          ),
        ),
      ),
    ),
  ),
);

inserir a descrição da imagem aqui xxxxx inserir a descrição da imagem aqui

applications – I am using cardview with gridview and in design panel my coding output is ok but when i run it on amy android phone it is not working

Below is my XML code:

<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:app=”http://schemas.android.com/apk/res-auto”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:orientation=”vertical”
android:weightSum=”10″
tools:context=”.MainActivity”>

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:background="@android:color/holo_orange_light">

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/first"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:text="Android Based Attendance Management System"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.125">

    </androidx.appcompat.widget.AppCompatTextView>

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/second"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Integrated With"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.498"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.50">

    </androidx.appcompat.widget.AppCompatTextView>

    <androidx.appcompat.widget.AppCompatTextView
        android:id="@+id/third"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="QR"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.50"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.80">
    </androidx.appcompat.widget.AppCompatTextView>

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.gridlayout.widget.GridLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="8"
    android:padding="14dp"
    app:alignmentMode="alignMargins"
    app:columnOrderPreserved="true"
    app:rowCount="2"
    app:columnCount="2">

    <!-- Row1 starts !-->

    <!-- Column1 starts !-->

    <androidx.cardview.widget.CardView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="8dp"
        app:layout_columnWeight="1"
        app:layout_rowWeight="1">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:orientation="vertical"
            android:layout_margin="16dp">

            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/admin_home_page_logo">

            </androidx.appcompat.widget.AppCompatImageView>

            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

            </androidx.appcompat.widget.AppCompatTextView>

        </androidx.appcompat.widget.LinearLayoutCompat>

    </androidx.cardview.widget.CardView>

    <!-- Column1 ends !-->


    <!-- Column2 starts !-->

    <androidx.cardview.widget.CardView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="8dp"
        app:layout_columnWeight="1"
        app:layout_rowWeight="1">


        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:orientation="vertical"
            android:layout_margin="16dp">

            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/teacher_logo">

            </androidx.appcompat.widget.AppCompatImageView>

            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

            </androidx.appcompat.widget.AppCompatTextView>

        </androidx.appcompat.widget.LinearLayoutCompat>


    </androidx.cardview.widget.CardView>

    <!-- Column2 ends !-->

    <!-- Row1 ends !-->



    <!-- Row2 starts !-->

    <!-- Column1 starts !-->

    <androidx.cardview.widget.CardView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="8dp"
        app:layout_columnWeight="1"
        app:layout_rowWeight="1">


        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:orientation="vertical"
            android:layout_margin="16dp">

            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/students_logo">

            </androidx.appcompat.widget.AppCompatImageView>

            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

            </androidx.appcompat.widget.AppCompatTextView>

        </androidx.appcompat.widget.LinearLayoutCompat>


    </androidx.cardview.widget.CardView>

    <!-- Column1 ends !-->


    <!-- Column2 starts !-->

    <androidx.cardview.widget.CardView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="8dp"
        app:layout_columnWeight="1"
        app:layout_rowWeight="1">


        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:orientation="vertical"
            android:layout_margin="16dp">

            <androidx.appcompat.widget.AppCompatImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/parents_logo2">

            </androidx.appcompat.widget.AppCompatImageView>

            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

            </androidx.appcompat.widget.AppCompatTextView>

        </androidx.appcompat.widget.LinearLayoutCompat>


    </androidx.cardview.widget.CardView>

    <!-- Column2 ends !-->

    <!-- Row2 ends !-->

</androidx.gridlayout.widget.GridLayout>

</androidx.appcompat.widget.LinearLayoutCompat>

And this is how my Gradle build is:

plugins {
id ‘com.android.application’
}

android {
compileSdkVersion 30
buildToolsVersion “30.0.3”

defaultConfig {
    applicationId "com.example.androidbasedattendancemanagementsystemusingqr"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

c# – Dropdownlist dentro de un gridview vuelve a su valor inicial al agregar una nueva línea

les cuento.

Estoy trabajando en c#, específicamente con un GridView, donde la primera columna de este tiene un control del tipo Dropdownlist, el cual me carga un tipo de presupuesto(celulosa,termopanel,etc,etc).

introducir la descripción de la imagen aquí

El problema que tengo es que al momento de agregar una línea (botón Nueva línea), el control dropdownlist vuelve a su valor inicial (celulosa) y no mantiene el valor que se había seleccionado antes.

introducir la descripción de la imagen aquí

Esto solo me pasa con el dropdownlist, ya que cuando agrego los otros campos textbox los muestra bien en el GridView.

introducir la descripción de la imagen aquí

El código que agrega una nueva linea es el siguiente

introducir la descripción de la imagen aquí

Con este cargo la estructura

introducir la descripción de la imagen aquí

Así es como cargo los valores del dropdownlist dentro del gridview

introducir la descripción de la imagen aquí

Cómo podría solucionar ese problema? de que al agregar una nueva línea me mantenga el valor seleccionado del dropdownlist.

Gracias de antemano

flutter – Como implementar o VoidCallback numa Lista de Itens para listar num Gridview?

Eu tentei seguir o tutorial deste link http://www.macoratti.net/19/07/flut_gridv1.htm pois tem uma listagem de itens em gridview mais próximo do que quero utilizar.

E então eu tentei adicionar uma opção de tornar esses itens clicáveis e fiz algumas pequenas modificações mas está dando erro na opção VoidCallback.

O erro retornado são estes:

  1. Invalid constant value - line 38
  2. The values in a const list literal must be constants - line 38
  3. Const variables must be initialized with a constant value - line 38

A parte do código que está dando erro é esse:

class ItemExemplo {
  const ItemExemplo({this.titulo, this.icon, this.onPressBtn});
  final String titulo;
  final IconData icon;
  final VoidCallback onPressBtn;
}

const List<ItemExemplo> itenslist = const <ItemExemplo>(
  const ItemExemplo(titulo: 'Carro', icon: Icons.directions_car),
  const ItemExemplo(titulo: 'Bike', icon: Icons.directions_bike),
  const ItemExemplo(titulo: 'Barco', icon: Icons.directions_boat),

  // o onPressBtn da linha abaixo é onde esta dando o erro, mas preciso dele pra função onTap do Widget que será exibido no grid.

  const ItemExemplo(titulo: 'Ônibux', icon: Icons.directions_bus, onPressBtn: () => print("Teste")),
);

Eu até entendo que o erro ta nas constantes, mas será que estou no caminho correto ou deveria refazer de outra maneira totalmente diferente? tem outro modo mais correto de fazer isso e que funcione?

Como ainda não existe um snippet para flutter aqui no SO eu coloquei o código completo no DartPad no link abaixo:

https://dartpad.dev/96d51e9f55496f4125ab6697d1a639e4

c # – Filter data from a gridview with the JQuery quicksearch plugin

I'm showing data in a gridview, I need to filter data in each column without going back to the base. I am using JQuery quicksearch, but searching each column exits the page and does not filter information. Please can you help me.

Here I present the code:

HTML CODE

       

                       
                           
                           
                               
                           
                           

                           
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                             
                               
                           
                       
                       
                       
                       
                       
                   

CODE C #

        protected void OnDataBound(object sender, EventArgs e)
         {
            GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, 
            DataControlRowState.Normal);
            for (int i = 0; i < gvEstaciones.Columns.Count; i++)
            {
                TableHeaderCell cell = new TableHeaderCell();
                TextBox txtSearch = new TextBox();
                txtSearch.Attributes("placeholder") = gvEstaciones.Columns(i).HeaderText;
                txtSearch.CssClass = "search_textbox";
                cell.Controls.Add(txtSearch);
                row.Controls.Add(cell);
            }
            gvEstaciones.HeaderRow.Parent.Controls.AddAt(1, row);
                }

JQUERY CODE

        

gridview – flap AnimatedCrossFade with two lists

I have a screen where you can change from ReorderableListView to gridview

The following code works without problems.

if (!snapshot.hasData || snapshot.data == CategoriesScreenBloc.GRID_VIEW) {
      return CategoriesGridView();
    }
    return CategoriesListView();

However, if I change it to this

return AnimatedCrossFade(
      crossFadeState: (!snapshot.hasData || snapshot.data == CategoriesScreenBloc.GRID_VIEW)
            ? CrossFadeState.showFirst
            : CrossFadeState.showSecond,
      firstChild: CategoriesGridView(),
      secondChild: CategoriesListView(),
      duration: const Duration(milliseconds: 100),
    );

I got the following error

ScrollController attached to multiple scrolling views

interesting, the error only appears when I try to reorder the elements and not when I change my view

android: the image is shown only in the first gridview element

The image is shown only in the first element in gridview. Below is my GridImageActivity where I am taking the image from the gallery or capturing it from the camera. After taking the image, the image is set only in the first gridview element.
How can I display the image in different gridview elements? Any help is appreciated. Thanks in advance.

 public class GridImage extends AppCompatActivity {
        GridView gv_gridimg;
        private Context context = this;
        Activity  activity;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_grid_image);
            gv_gridimg = findViewById(R.id.gv_gridimg);
            GridImgAdapter gridImgAdapter = new GridImgAdapter(this);
            gv_gridimg.setAdapter(gridImgAdapter);

                gv_gridimg.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView parent, View view, int position, long id) {
                        // gridImgAdapter.notifyDataSetChanged();  //to clear all the data that is assigned
                        String() galleryPermissions = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};

                        if (EasyPermissions.hasPermissions(context, galleryPermissions)) {
                            pickImageFromGallery();
                        } else {
                            EasyPermissions.requestPermissions(activity, "Access for storage", 101, galleryPermissions);
                        }
                    }
                });
            }


        private void pickImageFromGallery() {
            final CharSequence() options = {"Take photo", "Choose from gallery", "Cancel"};
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setTitle("Choose your profile picture");
            builder.setItems(options, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int item) {
                    if (options(item).equals("Take photo")) {
                        Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                        startActivityForResult(takePicture, 0);
                    } else if (options(item).equals("Choose from gallery")) {
                        Intent pickPhoto = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                        startActivityForResult(pickPhoto, 1);
                    } else if (options(item).equals("Cancel")) {
                        dialog.dismiss();
                    }
                }
            });
            builder.show();
        }
        @Override
        protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
            ImageView iv_gridimg = (ImageView) gv_gridimg.findViewById(R.id.iv_gridimg);

            if (resultCode != RESULT_CANCELED) {
                switch (requestCode) {
                    case 0:
                        if (resultCode == RESULT_OK && data != null) {
                            Bitmap selectedImage = (Bitmap) data.getExtras().get("data");
                             iv_gridimg.setImageBitmap(selectedImage);

                        }
                        break;
                    case 1:
                        if (resultCode == RESULT_OK && data != null) {
                            Uri selectedImage = data.getData();
                            String() filePathColumn = new String(){MediaStore.Images.Media.DATA};
                            if (selectedImage != null) {
                                Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
                                if (cursor != null) {
                                    cursor.moveToFirst();
                                    int columnIndex = cursor.getColumnIndex(filePathColumn(0));
                                    String picturesPath = cursor.getString(columnIndex);
                                    iv_gridimg.setImageBitmap(BitmapFactory.decodeFile(picturesPath));
                                    cursor.close();
                                }
                            }
                        }
                        break;
                }
            }
            super.onActivityResult(requestCode, resultCode, data);
        }
    }

This is my adapter class

public class GridImgAdapter extends BaseAdapter {
    private Context context;
    public GridImgAdapter(Context context) {
        this.context  = context;
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }
    @Override
    public boolean isEnabled(int position) {
        return true;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View gv_gridimg;
        gv_gridimg = layoutInflater.inflate(R.layout.item_grid_img,null);
        ImageView iv_gridimg = (ImageView) gv_gridimg.findViewById(R.id.iv_gridimg);
        return gv_gridimg;
    }
}

This is my main xml file

    
    
    

This is my article xml file



    

android studio – how do I put lines between items in a gridview

I'm doing a kind of calendar and I did a gridview to show the days of the week above, I can show them well but no line is shown that divides them and I would like to put a vertical line between each one or minimum that frames them


yii2 – Insert data in the database from a Gridview in Yii

I'm new to yii2 and I'm looking for a way to add a value to the database, from a botton I have created in a Gridview.
In other words, I would like to click on the button to insert a value in a field that I have in the database.
regards

c # – Problem with nested GridView Expand Collapse

How about I have a griview in ASP .NET with c # which brings an info from a SQL Server DB, what I try to do is something like that
see link, I'm guided on this page, but when I click on the image "more" it shows me the second fast gridview and it disappears besides that it does not let me open the other rows, only one until I reload the page, I do not know if I'm explaining well.

enter the description of the image here

Js

With the RowDataBound method I fill in the gridview I want to show with the gridview1 datakeynames

protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
code1 = GridView1.DataKeys[index].Values[0].ToString ();
code2 = GridView1.DataKeys[index].Values[1].ToString ();
GridView Gridview3 = e.Row.FindControl ("Gridview3") as GridView; string query = "select * from table..etc where code1 = '" + code1 + "' and code2 =" + code2 + "";
SqlCommand cm = new SqlCommand (query, with);
cm.CommandTimeout = 0;
SqlDataAdapter da = new SqlDataAdapter (cm);
dt = new DataTable ();
da.Fill (dt);
Gridview3.DataSource = dt;
Gridview3.DataBind ();
}
}
catch (Exception ex)
{
ex.ToString ();
}
}